From owner-freebsd-questions Wed Dec 11 11:20:16 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 9781B37B401 for ; Wed, 11 Dec 2002 11:20:14 -0800 (PST) Received: from sage-one.net (adsl-65-71-135-137.dsl.crchtx.swbell.net [65.71.135.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80E8D43EC5 for ; Wed, 11 Dec 2002 11:20:13 -0800 (PST) (envelope-from jackstone@sage-one.net) Received: from sagea (sagea [192.168.0.3]) by sage-one.net (8.11.6/8.11.6) with SMTP id gBBJKBd20709; Wed, 11 Dec 2002 13:20:12 -0600 (CST) (envelope-from jackstone@sage-one.net) Message-Id: <3.0.5.32.20021211132009.01e16160@mail.sage-one.net> X-Sender: jackstone@mail.sage-one.net X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Wed, 11 Dec 2002 13:20:09 -0600 To: Eric Six , "'freebsd-questions@FreeBSD.ORG'" From: "Jack L. Stone" Subject: Re: Cron script problem.... In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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 At 01:05 PM 12.11.2002 -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`; >`$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 > Eric: I'm no script expert, but perhaps if you added the full path to perl in the cron line. That's usually a problem.... Best regards, Jack L. Stone, Administrator SageOne Net http://www.sage-one.net jackstone@sage-one.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message