From owner-freebsd-questions Wed Dec 11 11:58:15 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 64DD237B401 for ; Wed, 11 Dec 2002 11:58:13 -0800 (PST) Received: from humpty.finadmin.virginia.edu (humpty.finadmin.Virginia.EDU [128.143.87.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D8A743EC2 for ; Wed, 11 Dec 2002 11:58:12 -0800 (PST) (envelope-from mrg8n@virginia.edu) Received: from humpty.finadmin.virginia.edu (localhost.finadmin.virginia.edu [127.0.0.1]) by humpty.finadmin.virginia.edu (8.12.6/8.11.6) with ESMTP id gBBJwBmu072599; Wed, 11 Dec 2002 14:58:11 -0500 (EST) (envelope-from mrg8n@virginia.edu) Received: (from mrg8n@localhost) by humpty.finadmin.virginia.edu (8.12.6/8.12.4/Submit) id gBBJwBda072598; Wed, 11 Dec 2002 14:58:11 -0500 (EST) (envelope-from mrg8n@virginia.edu) X-Authentication-Warning: humpty.finadmin.virginia.edu: mrg8n set sender to mrg8n@virginia.edu using -f Date: Wed, 11 Dec 2002 14:58:10 -0500 From: Mike Galvez To: Eric Six Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Cron script problem.... Message-ID: <20021211195810.GE52853@mail.virginia.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: Mutt/1.4i X-Operating-System: FreeBSD UNIX Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Dec 11, 2002 at 01:05:13PM -0600, Eric Six wrote: > Hi All, >=20 > 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. Wha= t 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; >=20 > ~begin~ > #!/usr/bin/perl -w > # tar cf filename.tar pathtotar/ >=20 > chomp ($SCP=3D`which scp`); > chomp ($SSH=3D`which ssh`); >=20 > $pathtomakebackup=3D"/bind_backups"; > chomp ($today=3D`date`); >=20 > my ($day,$month,$date,$time,$timezone,$year) =3D split (' ',$today); > $archive_date=3D"$month-$date-$year"; >=20 > `$SSH backupuser\@server13.blah.com mkdir ~/bind_backups/nsX/$archive_dat= e > > /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~ >=20 > 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 h= ave > it setup in cron; >=20 > 05 22 * * 1,3,5 perl /adminscripts/erics/bind_backup_scp.pl >=20 >=20 > It works fine from cron on Solaris and Linux... anyone have any ideas?=20 >=20 > TIA > Eric >=20 > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message --=20 Michael Galvez http://www.people.virginia.edu/~mrg8n Computer Systems Sr. Engineer Office: 434-982-2975=20 Financial Analysis E-Mail: mrg8n@virginia.edu University of Virginia Messenger Mail: Carruthers Hall Toilet Toup'=08ee, 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