Reputation: 184
I have setup a cron job as shown below but it won't run. When I run the script manually, I don't see any errors.
#_____WPR Jobs
00 9 * * * mon-sat /var/spool/ftpexts/bin/exe_get_x_wpr.sh >> /var/spool/ftpexts/outboundlogs/exe_get_x_wpr.log
00 9 * * * mon-sat /var/spool/ftpexts/bin/exe_get_y_wpr.sh >> /var/spool/ftpexts/outboundlogs/exe_get_y_wpr.log
00 9 * * * mon-sat /var/spool/ftpexts/bin/exe_get_z_wpr.sh >> /var/spool/ftpexts/outboundlogs/exe_get_z_wpr.log
When I execute the script manually as shown below, it runs smoothly with log records too.
/var/spool/ftpexts/bin/exe_get_x_wpr.sh >> /var/spool/ftpexts/outboundlogs/exe_get_x_wpr.log
Upvotes: 0
Views: 131
Reputation: 263617
crontab
is trying to execute mon-sat
as a command.
The day of the week is specified as the 5th field of a crontab entry. You have *
, which means it runs on any day of the week. Delete that 5th field, making mon-sat
the 5th field. (Interesting, I didn't know until now that crontab would recognize names.)
UPDATE: The crontab(5) man page (type man 5 crontab
to read it on your system) says:
Names can also be used for the "month" and "day of week" fields. Use the first three letters of the particular day or month (case doesn't matter). Ranges or lists of names are not allowed.
You say that mon-sat
worked for you. A quick experiment indicates that ranges of names actually do work, but since the documentation says they're not allowed, I suggest not depending on that. Write 1-6
rather than mon-sat
if you want the job to run Monday through Saturday.
Upvotes: 2