1

What might cause cron to suddenly report a file it is supposed to run is "not found," when the file hasn't been touched, and in fact, the entire system hasn't been touched since it last ran successfully?

I have a cronjob schedule I define by doing sudo crontab -e.

In it, I have dozens of cron jobs that run successfully.. I do not have a PATH specified, and I use absolute paths to call all my scheduled scripts, setting the PATH in them as needed. I do not specify a SHELL in the crontab. All scripts identify the shell as their first line.

Without me touching the system, a particular job defined in the middle of other jobs will suddenly stop running.

To debug this, I added an output redirection to a log file. In that, the output clearly shows the output of the script successfully running time after time for weeks, and then suddenly the following appears:

/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found
/bin/sh: /home/iupress/bin/sync-email_images: not found

If I do the ls command, copying and pasting that exact path from the error message, it clearly reports the file is still there (no surprise). Yet the log continues to report that file is "not found" until I take action.

I can run the script manually and it runs just fine.

If I do sudo crontab -e and save the file, the job runs on the next scheduled time, putting its output in the log, no longer reporting the script is "not found".

It seems to me the contents of the script trying to be run are irrelevant since cron doesn't even process the file because it is "not found".

I have a job scheduled below the one that is encountering this problem that I know is continuing to run, because I have its output mailed to me. So I know cron is running and continues to run at least one other job, even after it suddenly reports this job's script is "not found".

All my lines end with a newline. I had no periods in the crontab until I added the redirection to a log file. I have now added a PATH specification, but left the absolute paths in the jobs. Unfortunately, I have no idea if and when this problem will occur. It will likely be weeks from now.

By the way, I am running a script to syncronize the clock, and I see the time is exactly what it should be.

1 Answer 1

0

Not entirely sure if this will be of any help. But restarting your cron may/or may not help.

sudo service cron restart 
1
  • I check to make sure the service is running when this has happened and it is. Issued the command anyway.
    – Ted B
    Jul 5, 2012 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .