Results 1 to 3 of 3
Hi there, I am new to linux and I am learning something every day. Could you please help me with this script.
It will run in a cronjob every 10 ...
- 12-31-2010 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 9
Script help.
Hi there, I am new to linux and I am learning something every day. Could you please help me with this script.
It will run in a cronjob every 10 mins.
I have a weather station that is located at another location, it sends mysql updates to a remote server every 15 minutes. When the internet goes down it only send the most recent. There is a script that runs that will update everything from a certain timestamp onwards so that is fixable. What I want to do it get something that writes the time it went offline to the file and then execute it.
I have done this....
I know... advanced eh?!Code:ping google.com -c 1 && date +%s > test
So that does what I want in part as it will stop updating the time once offline (i think)
Ideally then if it has been offline and comes back it runs the other script to update it.
How would i then make it run something once back online after a period of being offline.Last edited by latitudehopper; 12-31-2010 at 03:49 PM.
- 12-31-2010 #2
What you are currently doing is overwriting the file with the last timestamp.
Could you instead add the timestamp to the file (use ">>" instead of ">"), and then check the gap between the last timestamp and the current timestamp? If the gap is over 10 minutes, then you know that you just came back from an outage.DISTRO=Arch
Registered Linux User #388732
- 01-01-2011 #3Just Joined!
- Join Date
- Dec 2010
- Posts
- 9
Good idea, this was the avenue I was thinking of taking.... now just trawling through the manual online to work out how to make it happen! Every day is a school day.
Any pointers would be welcomed.
J


Reply With Quote