To check if a script is being executed every 5 minutes

we planned to run the script every 5 minutes.

how can we check if a script is being executed every 5 minutes in Linux?

If anyone knows please answer.

Thanks in Advance.

We have created a script. But we are not running this script. Our support team will be running this every minute. If they find any error, they will be updated. How can we confirm that they are running this script correctly?

+1


a source to share


4 answers


If you don't want to change your script and you have it scheduled in cron, you can change the 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 of each run.

+5


a source


Perhaps by creating a script log in a timestamped log file so you can check if the timestamp matches, e.g .:

date >>/tmp/myprocess.log

      



at the top of the script (or in a loop if that's the way you run it), you can check the log file you need to check.

+2


a source


Perhaps you could add a timestamped log to the script? Then you can see if the script actually runs every 5 minutes.

0


a source


No script change?

atop

is a process monitoring package that can record the history of running programs and, as root, will also terminate. 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

0


a source







All Articles