Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2002 14:58:10 -0500
From:      Mike Galvez <mrg8n@virginia.edu>
To:        Eric Six <erics@sirsi.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Cron script problem....
Message-ID:  <20021211195810.GE52853@mail.virginia.edu>
In-Reply-To: <DC32C8CEB3F8D311B6B5009027DE5AD505E33F68@stlmail.dra.com>
References:  <DC32C8CEB3F8D311B6B5009027DE5AD505E33F68@stlmail.dra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wed, Dec 11, 2002 at 01:05:13PM -0600, Eric Six wrote:
> 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`;
^^^^^^^^^^^
Does the user have permission to write to this file?

> `$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

-- 
Michael Galvez             http://www.people.virginia.edu/~mrg8n
Computer Systems Sr. Engineer         Office: 434-982-2975 
Financial Analysis                    E-Mail: mrg8n@virginia.edu
University of Virginia        Messenger Mail: Carruthers Hall

Toilet Toup'ee, n.:
	Any shag carpet that causes the lid to become top-heavy, thus
creating endless annoyance to male users.
		-- Rich Hall, "Sniglets"

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?20021211195810.GE52853>