how can i run/check my script every time in linux machine
Hi all,
i have a script that checks whether our internet is UP || DOWN. I need to run/check this script every time set host1=www.google.com echo $(((ping -w5 -c3 $host1) > /dev/null 2>&1) && echo "up" || (echo "down" && exit 1)) Note: If my internet connection is down machine is automatically send mail... for this reason I need check/run this code every time Any body have knowledge please share with me... Thanks, Selvavinayakam.na |
Quote:
That being said assuming you have alternate means of communication for your system, you can run your script regularly using cron (see man pages cron(8), crontab(1), crontab(5)). I actually recommend you running a more thorough monitoring solution such as Icinga. SAM |
so do you want that script should be executed if internet is down or it should be executed continuously.
if you want it should run in regular interval,use crontab and define your time interval so it will run according to that. |
Quote:
Quote:
|
Quote:
|
Thanks sam,karim.ouda,TB0ne for suggesting crontab... I am looking on that friends...
after ur's suggestion I created like, for every 5 min email will send to my mail "internet is up". if, i am not getting this mail i take steps to checks internet connection (Alert signal) for every 5Min . is this way is correct ? i am waiting for reply.... Thanks, Selvavinayakam.na |
Quote:
http://superuser.com/questions/31184...ernate-gateway **EDIT** Quote:
If I were you I would have a second server off site (hosting maybe?) which gives an outside perspective of your internet. That outside server can then email you or text message you. One example would be connecting via public key auth over SSH to a remote server on hosting and outputting a timestamp to a file. Then you can read that file and if the timestamp is older than 310 seconds then it means the server hasn't checked in in longer than 5 minutes. It would certainly provide a lot less chatter in your email and you would only be notified if it is important. SAM |
Thanks Sam, I got Right way to explore new things....
Selvavinayakam.na |
Quote:
|
oK, I accept your point of view...
Selvavinayakam.na Quote:
|
All times are GMT -5. The time now is 06:50 PM. |