Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
use the error output /bin/duply calendar backup > /tmp/duply.log >> /tmp/duply.error.log and post to see the something error –  Andrés Ricardo Torres Martínez Jun 22 '12 at 15:34
    
now /tmp/duply.log is empty, while /tmp/duply.error.log contains: Start duply v1.5.7, time is 2012-06-22 18:02:01. –  Guandalino Jun 22 '12 at 16:06
1  
so sorry, this is no the syntax for output error! , is /bin/duply calendar backup > /tmp/duply.log 2> /tmp/duply.error.log ,maybe in file contains duply.error.log some information of crash depends of duply –  Andrés Ricardo Torres Martínez Jun 23 '12 at 0:45
    
Thanks Andrés, fixed. The error file said: duplicity 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. –  Guandalino Jun 23 '12 at 7:10
    
Now the crontab file starts with: PATH=/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. –  Guandalino Jun 23 '12 at 7:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.