LinHES Forums
http://forum.linhes.org/

MythDB Auto-Backup Fails
http://forum.linhes.org/viewtopic.php?f=6&t=13843
Page 1 of 1

Author:  md10md [ Thu Jan 25, 2007 11:26 pm ]
Post subject:  MythDB Auto-Backup Fails

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

Author:  tjc [ Thu Jan 25, 2007 11:39 pm ]
Post subject: 

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.

Author:  md10md [ Thu Jan 25, 2007 11:49 pm ]
Post subject: 

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

Author:  tjc [ Fri Jan 26, 2007 12:12 am ]
Post subject: 

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

Author:  md10md [ Fri Jan 26, 2007 10:50 am ]
Post subject: 

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?

Author:  tjc [ Fri Jan 26, 2007 7:21 pm ]
Post subject: 

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/