Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2002 13:05:13 -0600
From:      Eric Six <erics@sirsi.com>
To:        "'freebsd-questions@FreeBSD.ORG'" <freebsd-questions@FreeBSD.ORG>
Subject:   Cron script problem....
Message-ID:  <DC32C8CEB3F8D311B6B5009027DE5AD505E33F68@stlmail.dra.com>

next in thread | raw e-mail | index | archive | help
Hi All,

I am having a weird problem on a freebsd 4.7. I have two perl scripts I am
running via cron, one is run as root to make a backup of a directory and the
files in it, the second is run as a user to scp files to another box. What I
am encountering is the second script is running but dying after the first
ssh remote command. Here is what second script does; it uses ssh remote
command to create a directory on the remote server with todays date, the
next command is the actual recurise scp command. Here is what the script
looks like;

~begin~
#!/usr/bin/perl -w
# tar cf filename.tar pathtotar/

chomp ($SCP=`which scp`);
chomp ($SSH=`which ssh`);

$pathtomakebackup="/bind_backups";
chomp ($today=`date`);

my ($day,$month,$date,$time,$timezone,$year) = split (' ',$today);
$archive_date="$month-$date-$year";

`$SSH backupuser\@server13.blah.com mkdir ~/bind_backups/nsX/$archive_date >
/var/log/ssh.log 2>&1`;
`$SCP -vr $pathtomakebackup/$archive_date/
backupuser\@server13.blah.com:~/bind_backups/nsX/ > /var/log/scp.log 2>&1`;
~end~

If I run the script interactively, it works fine. From CRON it dies after
the SSH command makes the directory on the remote server. Here is how I have
it setup in cron;

05 22 * * 1,3,5 perl /adminscripts/erics/bind_backup_scp.pl


It works fine from cron on Solaris and Linux... anyone have any ideas? 

TIA
Eric

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DC32C8CEB3F8D311B6B5009027DE5AD505E33F68>