crontab example
Hello.
I run "crontab -e" and add below task: * * * * * /bin/ping google.com and it mean that my system must ping google every day and every time but I can't see the result!!! How can I see it? Thank you. |
Where would you expect to see it?
Cron is not connected to a terminal. You can send it to a file or have cron email it to you. And if you must ping from cron, you really should limit how long that process continues. |
IIRC the default is that output is sent as a local e-mail. Check your local mailbox.
You might even be able to trick it into showing a graphical dialog by setting the DISPLAY variable, assuming it is the same account that you are running the desktop environment on: Code:
# untested |
You could use simple output redirection
* * * * * /bin/ping google.com >> /path/to/file Altho if I were to do it, I'd create a bash script so that you can get the time/date in that resulting file too. Also you say that it must ping google everyday, this is incorrect, you've set this up to run every minute. You would need to set an explicit time to make it daily, such as 15 2 * * * /bin/ping google.com >> /path/to/file This would make it run at 2:15AM everyday. |
As "astrogeek" had mentioned, you should limit the ping.
In Windows if you ping blahblah.com it will ping 4 times. But in Linux you need to specify the option "-c" as others has already mentioned. Adjust the ping to: /bin/ping -c 4 -w 1 google.com It will ping 4 times and not infinite. Good luck! |
Quote:
Thank you a lot. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 04:04 PM. |