On Mon, 15 Mar 2004 15:27:20 -0700
David Bear <[EMAIL PROTECTED]> wrote:

> 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.

For future reference, you can achieve the same effect with the -x

i.e. add "-x" to the first line of the script, or run the script with

  sh -x l0dump.sh

> 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}

I think this line is your problem.  It's trying to set the variable MT
to "/usr/bin/mt -f ", then run the command ${DEST}.  Of course, ${DEST}
isn't a command, it's a device, which isn't executable, which is why you
get "permission denied."

I think that if you rewrite the line as the following, it'll do what you

  MT="/usr/bin/mt -f ${DEST}"

[EMAIL PROTECTED] mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to