tags:

views:

120

answers:

4

Hi,

we have scheduled one script to run for every 5 mins.

how we can check that whether the script is running for every 5 minutes in linux?

If anyone knows, please Reply..

Thanks in Advance.

We have created the script. But we dont run that script. Our Support team will run this for every minutes. If they found any error, then they will update to us. How we can cofirm that they r running this script properly or not?

+2  A: 

Maybe by making the script log in a logfile with the timestamp, so you can verify if the timestamp is OK, something like:

date >>/tmp/myprocess.log

at the top of the script (or in the loop if that's how you're "running" it) then you can examine the log file to check.

Valentin Rocher
Good idea, +1 with a tiny bit more detail :-)
paxdiablo
A: 

Maybe you could just add a log with a timestamp in your script ? Then you could see if the script was effectively run every 5 min.

MickTaiwan
+5  A: 

If you don't want to modify your script and you've scheduled it in cron, you could change your cron line to:

*/5 * * * * /home/me/myscript.sh; date >> /tmp/mylog

And check /tmp/mylog - a new line should be added with the date and time every run.

gacrux
A: 

Without changing the script?

atop is a process monitor package that can record history of programs being run, and as root will catch terminations as well. See http://www.atcomputing.nl/Tools/atop/whyatop.html

Also consider the process accounting tools http://www.faqs.org/docs/Linux-mini/Process-Accounting.html

Autocracy