On Sat, Feb 8, 2014 at 2:59 PM, S. Dale Morrey <sdalemor...@gmail.com>wrote:

>
> This makes me wonder if I need to specify HOME as in "export HOME=/root"
> I'm going to give that a shot and see if it solves the problem.
>
>
It may depend on what version of cron you have installed. Here is what mine
says about it:

       Several  environment  variables are set up automatically by the
cron(8) daemon.  SHELL is set
       to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line
of  the  crontab's  owner.
       PATH  is  set to "/usr/bin:/bin".  HOME, SHELL, and PATH may be
overridden by settings in the
       crontab; LOGNAME is the user that the job is running from, and may
not be changed.

When I had a problem like this before, the thing that fixed it for me was
to wrap the command in a script. So, your cron entry might be:

0 1 * * * /bin/bash /root/backup_mysql.sh

and then your script would simply be:

#!/bin/bash
mysqldump dbname

I never figured out the actual problem, but I'm sure it was related to
environmental variables like you suggest or perhaps the difference between
/bin/sh and /bin/bash.

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to