[svlug] Bash scripts and cron

John McDonnell svlug_spam at johnmc.org
Fri Jan 10 07:43:41 PST 2003

Morning all,

I have a problem that's been bugging me and I'm wondering if anyone can
shed some light on it. I have a set of backup scripts that run perfectly
from the command line but fail when called from cron.

It's a simple tar and scp script and it looks fine to me. This is on 5
different Cobalt Raqs. What happens is that tar runs fine, but the scp
never happens.

Anyone able to point out the obvious? I've made sure the keypairs are all

here's the script (with the names modified to protect the innocent, it
should still be obvious enough):


tar czfp /tmp/$host-home.tar.gz --exclude='*/stats/*' \
 --exclude='*/logs/*' /home/sites/home/
scp -u -P $port /tmp/$host-home.tar.gz cobalt@$dest:$host

tar czfp /tmp/$host-site1.tar.gz --exclude=\'*/stats/*\' \
    --exclude=\'*/logs/*\' /home/sites/site1;
scp -u -P $port /tmp/$host-site1.tar.gz cobalt@$dest:$host;

for i in `seq 2 19`; do
  tar czfp /tmp/$host-site$i.tar.gz --exclude=\'*/stats/*\' \
    --exclude=\'*/logs/*\' /home/sites/site$i*;
   scp -u -P $port /tmp/$host-site$i.tar.gz cobalt@$dest:$host;

date +"%Y-%m-%d" > ~johnmc/last_full


 . johnmc@ | bucketchild.net - +1-408-985-7992 (home) .
 . http:// | johnmc.org      - +1-408-386-3549 (cell) .

More information about the svlug mailing list