[PLUG] cron job won't run

Michael Montagne michael at themontagnes.com
Sat Mar 5 01:33:02 UTC 2005


>On 03/04/05, Terry Griffin busted out the keyboard and typed:

> On Fri, Mar 04, 2005 at 04:50:07PM -0800, Michael Montagne wrote:
> > I have a cron job that calls a shell script shown below.  The rsync
> > commands don't seem to run.  I know the script runs cause the log file
> > at the end is correctly incremented.  Wonder what I've done wrong.
> > The same script runs correctly when called from the command line.
> > 
> > #!/bin/bash
> > rsync -Cavz --delete --exclude-from=exclude.txt mike at opsis:/Array/Office/General /store
> > rsync -Cavz --delete --exclude-from=exclude.txt mike at opsis:/Array/Office/Resource /store
> > rsync -Cavz --delete --exclude-from=exclude.txt mike at opsis:/Array/Marketing /home/backup
> > rsync -Cavz --delete --exclude-from=exclude.txt mike at opsis:/Array/Accounting /home/backup
> > echo `date` >> ~/backuplog.txt
> > scp ~/backuplog.txt mike at opsis:~
> > 
> >
> 
> Frequently this is due to something in your environment, or rather 
> something that's missing from your cron job's environment. Try putting 
> this line in your script:
> 
>    env > /tmp/my-cron-script.env
> 
> Let the cron job run then compare the contents of /tmp/my-cron-script.env 
> to what you get when you run the env command from your shell prompt.
> 
> Terry

Not sure what to do with this data:

my-cron-script.env:

SHELL=/bin/sh
PATH=/usr/bin:/bin
PWD=/home/mike
LANG=en_US.UTF-8
HOME=/home/mike
SHLVL=2
LANGUAGE=en_US:en_GB:en
LOGNAME=mike
_=/usr/bin/env

And from an ssh session:
mike at ubuntu:~$ env
TERM=rxvt
SHELL=/bin/bash
SSH_CLIENT=::ffff:192.168.0.5 56934 22
SSH_TTY=/dev/pts/0
USER=mike
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:
MAIL=/var/mail/mike
PATH=/home/mike/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
PWD=/home/mike
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/mike
LANGUAGE=en_US:en_GB:en
LOGNAME=mike
SSH_CONNECTION=::ffff:192.168.0.5 56934 ::ffff:192.168.0.107 22
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env


-- 
Michael Montagne
michael at themontagnes.com
http://www.themontagnes.com



More information about the PLUG mailing list