From owner-freebsd-questions@FreeBSD.ORG Mon Mar 15 14:29:16 2004 Return-Path: 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 0B4C816A4CE for ; Mon, 15 Mar 2004 14:29:16 -0800 (PST) Received: from post5.inre.asu.edu (post5.inre.asu.edu [129.219.110.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id D409143D39 for ; Mon, 15 Mar 2004 14:29:15 -0800 (PST) (envelope-from David.Bear@asu.edu) Received: from conversion.post5.inre.asu.edu by asu.edu (PMDF V6.1-1X6 #30769) id <0HUN002012DJP4@asu.edu> for freebsd-questions@freebsd.org; Mon, 15 Mar 2004 15:27:19 -0700 (MST) Received: from smtp.asu.edu (smtp.asu.edu [129.219.110.107]) by asu.edu (PMDF V6.1-1X6 #30769) with ESMTP id <0HUN00MKY2DJVZ@asu.edu> for freebsd-questions@freebsd.org; Mon, 15 Mar 2004 15:27:19 -0700 (MST) Received: from moroni.pp.asu.edu (moroni.pp.asu.edu [129.219.120.183]) (8.12.10/8.12.10/asu_smtp_relay,nullclient,tcp_wrapped) with ESMTP id i2FMRKQw018368 for ; Mon, 15 Mar 2004 15:27:20 -0700 (MST) Received: by moroni.pp.asu.edu (Postfix, from userid 500) id 3DE689C9; Mon, 15 Mar 2004 15:27:20 -0700 (MST) Date: Mon, 15 Mar 2004 15:27:20 -0700 From: David Bear To: freebsd-questions@freebsd.org Message-id: <20040315222720.GF28684@asu.edu> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-disposition: inline User-Agent: Mutt/1.4.1i Subject: issue with simple script X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David.Bear@asu.edu List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2004 22:29:16 -0000 I thought I had a tape issue.. Now its clear I have a script issue. Below is a script I use to perform level 0 dumps on all mounted file systems. The problem seems to be that when the script runs, it does not run as root -- even though I am root when I run it. The goal is to cron it, but as I was testing it I ran into some problems. First, I can't set the MT variable as its listed below. I get an permission denial on /dev/nrsa0. This makes no sense, since as root I can issue the command fine. Moreover, the dump command itself fails even thought it seems to be rendered syntactically correct. I echo'ed all the generated commands just to make certain they are correct. Here's the output of the script: ===================================================== ppsrvx# ./l0dump.sh ./l0dump.sh: /dev/nrsa0: permission denied comp off /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/ad0s1a /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/da1s1d /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/da0s1e /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/da1s1e /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/ad0s1d /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/da0s1d /sbin/dump -0u -a -b 64 -f /dev/nrsa0 /dev/ad0s1e /dev/sa0 offline ====================================================== notice the permission denied.. not also 'comp off' which SHOULD be rendered as /usr/bin/mt -f /dev/nrsa0 comp off but isn't. I'm really stumped here. Is there some reason why running these commands in a script would fail, yet running them by hand works? ======================================================== #!/bin/sh AWK=/usr/bin/awk DF=/bin/df DMP=/sbin/dump DEST=/dev/nrsa0 MT="/usr/bin/mt -f " ${DEST} MOPTS='weof 1' DOPTS='-0u -a -b 64 -f ' # -b 64 is max, will never use large value FSS=`${DF} | ${AWK} '/dev/ {print $1}'` echo ${MT} 'comp off' # echo ${MT} 'blocksize 512' for FS in ${FSS} ; do echo ${DMP} ${DOPTS} ${DEST} ${FS} # ${MT} ${MOPTS} done echo ${MT} '/dev/sa0 offline' echo "Please swap tapes on srvx" | mail iddwb ======================================================== -- David Bear phone: 480-965-8257 fax: 480-965-9189 College of Public Programs/ASU Wilson Hall 232 Tempe, AZ 85287-0803 "Beware the IP portfolio, everyone will be suspect of trespassing"