Yikes! Something strange in a cron job.
S. Dale Morrey
sdalemorrey at gmail.com
Sat Feb 8 15:16:49 MST 2014
Yeah it is wrapped up in a script already. But thanks, I'm setting the
HOME variable and seeing if that works.
On Sat, Feb 8, 2014 at 3:14 PM, Joshua Marsh <joshua at themarshians.com>wrote:
> On Sat, Feb 8, 2014 at 2:59 PM, S. Dale Morrey <sdalemorrey at gmail.com
> > 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:
> 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.
More information about the PLUG