backup: Backup stops unexpectedly when running from crontab

Hi backupers!

I have setup a crontab to run my backup job every night. It has worked perfectly for some time, sending me an email each day with an enjoyable “Success” status. (I’m on ruby 1.9.2-p290, backup 3.0.23)

For some days however, I do not get the email anymore… I had some checks to find what’s going on:

  • the backup is still working (at least partially, you’ll see why),
  • I can run the backup manually, it works, completely, telling me on the terminal it completed and succeeded and sending me the email.

Looking at the backup.log file, I found that my backup was stopping unexpectedly during the S3 sync process. At some point, after having processed (skipped or transferred) 167 files, the log just stops. No error, no completion log, no email, nothing. It just stops, and start again later when the next backup job starts.

So this happens only when the job is run from the crontab, not when I run it manually. Does someone have an idea of what may cause this issue? It’s quite disturbing.

Thanks in advance! Romain

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

Hi,

Thanks you both for helping so much! I’ll try to provide you with as much details as I think of…

I just tried with your command instead of my wrapper script: this doesn’t help. Here is my test crontab (as displayed by crontab -l when logged in as user):

# m h  dom mon dow   command
*/20 * * * * /home/user/Backup/run.sh db_frequent
10 3 * * * /home/user/Backup/run.sh db_daily
10 4 * * * /home/user/Backup/run.sh files
15 3 * * * /home/user/Backup/run.sh archive
8 9 * * * bash -l -c 'backup perform --trigger files'

The last line is the one I just added to check your tip, but I got the same result as usual (you can see the backup log for last two backup job in this gist (I just changed the user name, application name and removed backed up avatar filenames so that it could be made public). You will see: no concurrency, files job stops unexpectedly after 153 files this time.

The wrapper script is quite simple. I used it essentially to deal with rbenv, but your bash -l -c thing seems to work just fine too. Here is the wrapper:

#!/bin/bash

source ~/.profile
backup perform --trigger $1

Concerning shell initialization scripts (don’t know the real name, I mean .profile and .bashrc, which are the ones I have), .bashrc is 100% Ubuntu’s default one. .profile is default’s too except for these two lines added during rbenv installation:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

I’ve no .bash_profile or .bash_login, so bash is reading .profile.

Well, this is all I think of. Hoping it may help! Thanks again for your help 😃