I have a problem with a cron job which starts but doesn't complete. Running the command manually works fine. I already read the page about cron issues and solutions here on AskUbuntu, tried the proposed solutions but didn't find an answer working in my case.
I'm using Ubuntu 12.04.
$ crontab -e
SHELL=/bin/bash # otherwise it would be /bin/sh
59 16 * * * /bin/duply calendar backup > /tmp/duply.log
Btw, the cron file ends with an empty line, as someone pointed out.
Once the job has "finished"...:
$ cat /tmp/duply.log
Start duply v1.5.7, time is 2012-06-22 16:59:01.
Instead, running manually the script it works correctly and gives this output:
Start duply v1.5.7, time is 2012-06-22 17:06:39.
[cut]
... here is a long output generated by duply.
... and yes, files have been backed up.
[cut]
--- Finished state OK at 17:06:42.581 - Runtime 00:00:03.170 ---
I also tried to restart the cron daemon (sudo service cron restart
) but nothing changed.
Do you have any suggestion to fix the issue?
/bin/duply calendar backup > /tmp/duply.log >> /tmp/duply.error.log
and post to see the something error – richie-torres Jun 22 '12 at 15:34/tmp/duply.log
is empty, while/tmp/duply.error.log
contains:Start duply v1.5.7, time is 2012-06-22 18:02:01.
– Paolo Jun 22 '12 at 16:06/bin/duply calendar backup > /tmp/duply.log 2> /tmp/duply.error.log
,maybe in file containsduply.error.log
some information of crash depends ofduply
– richie-torres Jun 23 '12 at 00:45duplicity missing. installed und available in path?
. So I added to the cron file the same PATH value I have in shell session and the issue disappeared. I didn't think it was required to add PATH to the crontab file because PATH during the cron job is/usr/bin:/bin
, and duply resides in/bin
. – Paolo Jun 23 '12 at 07:10PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
. PS: would you mind to add your investigation approach to the wiki page I pointed out in my question, and maybe convert your comment to an answer here? I'd like to upvote for your help. – Paolo Jun 23 '12 at 07:12