View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 6 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: MythDB Auto-Backup Fails
PostPosted: Thu Jan 25, 2007 11:26 pm 
Offline
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
I have mythbackup set to run in my crontab every three days at 3am but for some reason it just fails every time and I end up getting two files (mythconverg.sql and savedfiles.tar.bz2) with sizes around 4KB. Running mythbackup by itself works fine, by the way. Here's what the relevant portion of /etc/crontab looks like.

Code:
0 3 */3 * *        root         mythbackup


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 11:39 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
What environment settings are missing? When you run interactively as root you have a different environment than when a cronjob or other automatically/remotely kicked off process is started. Put the full path to an executable script which does something like this in your /etc/crontab:
Code:
#!/bin/bash
/usr/bin/env | /usr/bin/sort >/tmp/cron.env.log
exit 0


Then after that cron job has run, run the these commands interactively as root:
Code:
/usr/bin/env | /usr/bin/sort >/tmp/live.env.log
/usr/bin/diff /tmp/cron.env.log /tmp/live.env.log

I'll guess that at the very least your PATH is different.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 11:49 pm 
Offline
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
Alright it's a little different but most of it seems to be stuff like ssh connections and the like.

live.env.log (Took out ssh stuff as it had ports and unwanted info)
Code:
DISPLAY=localhost:10.0
HOME=/root
KRP_DIR=/usr/lib/krp
LANG=C
LANGUAGE=us
LOGNAME=root
MAIL=/var/mail/root
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games
PWD=/root
SHELL=/bin/bash
SHLVL=1
SSH_TTY=/dev/ttyp0
TERM=xterm
USER=root
_=/usr/bin/env


cron.env.log
Code:
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PWD=/root
SHELL=/bin/sh
SHLVL=1
_=/usr/bin/env


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 12:12 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
md10md wrote:
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PWD=/root
SHELL=/bin/sh
SHLVL=1
_=/usr/bin/env

Either of these could be an issue. Also, make sure you use the full path name to the script in your /etc/crontab


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 10:50 am 
Offline
Joined: Sat Jun 25, 2005 7:39 pm
Posts: 162
Well I changed the crontab to point to "/usr/local/bin/mythbackup" instead of just mythbackup so I'll see how that goes but both environments have /usr/local/bin in the path so I wonder if that's not the issue. What could be the issue if /bin/sh or /bin/bash are used?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 7:21 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
The scripts use various bash features. If it really is emulating pure sh then some of those wouldn't work. If the full pathname doesn't work, we try telling it to run:
Code:
/bin/bash /usr/local/bin/mythbackup


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu