Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I tail the running cron job, so that I can come to the conclusion that my job is going on.

share|improve this question

migrated from May 17 '11 at 10:41

This question came from our site for professional and enthusiast programmers.

In your script you could echo something like echo 'My job started on: ' $(date) and in your cron, redirect both the stdout and the stderr to a file:

* * * * * /path/to/your/job &>/tmp/MyJobLog

If you want to check 'live' what your job is doing, just do tail -f /tmp/MyJobLog

Another option is to log the start (or the end) of your script in syslog with the logger command if supported by your distro.

share|improve this answer
Here the /path/to/your/job means the location of the cron file or the location of the script which I enter in the cron file?? – Srikk May 17 '11 at 8:36
This is the path to your script. It is highly recommended to always specify full path to all scripts and commands in the cron file as it usually has no value for the PATH environment variable unless specifically set in the cron file. – ripat May 17 '11 at 9:23

You need to find out the PID of your job:

ps ax | grep jobname

After that you can check if your job is working, by tracing its actions with strace.

share|improve this answer

You must log in to answer this question.