predicting when a script will fail

predicting when a script will fail

Post by J » Thu, 17 Oct 2002 21:30:46



Take the following script for example:

echo "Myprocess1 StartTime: `date`" >> /home/me/log.txt

./10347.a
echo "Myprocess EndTime: `date`" >> /home/me/log.txt

If the user who runs this script doesn't have permission to write to
log.txt, an error will be returned and the script will halt without
processing any other lines.  But if the file 10347.a cannot be found,
an error is return but the remainder of the script will be executed.
How can I predict whether or not the script will halt for a particular
error?

Thanks!

 
 
 

predicting when a script will fail

Post by Kevin Rodger » Fri, 18 Oct 2002 02:44:43



> Take the following script for example:

> echo "Myprocess1 StartTime: `date`" >> /home/me/log.txt

> ./10347.a
> echo "Myprocess EndTime: `date`" >> /home/me/log.txt

> If the user who runs this script doesn't have permission to write to
> log.txt, an error will be returned and the script will halt without
> processing any other lines.  But if the file 10347.a cannot be found,
> an error is return but the remainder of the script will be executed.
> How can I predict whether or not the script will halt for a particular
> error?

You didn't say which shell you're using.  I use ksh, and according to
Chapter 11 (Command Processing) of The Korn Shell Command and Programming
Language by Bolsky & Korn:

If redirection fails within a script or function, the script or function
terminates.

Errors in these built-ins cause the script that contains them to terminate:

        .       :       alias   break   cointinue       eval    exec    exit
        export  newgrp  readonly        return  shift   times   trap
        typeset wait

I suspect the man page for your shell has similar info.

--
<a href="mailto:&lt;kevinr&#64;ihs.com&gt;">Kevin Rodgers</a>

 
 
 

1. RPM Package install failed: script execution failed...

Well, I cleared up my linuxppc video problem in the installer by going
with mklinux from the linuxppc v4 CD instead.  I was able to get RPM
running, and repartition my disks, and get the installer running.  But
when the installer gets to installing packages I got many "Package
Install failed: script execution failed" errors.  This is not a very useful
message, I must say.

This occurred on many packages (~50%?), but by no means all, and I
couldn't seem to make out a pattern, except that it always happened at
the end of a package install, when the progress bar for that package
was full.

I tried to finish the install, in the hopes that enough would be
installed that I'd be able to boot, and get a copy /tmp/install.log,
but no dice.  After the mouse selection (ADB Mouse - emulate 3
buttons), the install hung - no disk activity, no CD activity, and I
couldn't use the alt-F? keys to get to the virtual consoles.  

I have no idea what's going on.  Help would be much appreciated...

J.

2. permissions problem

3. RPM install of XXX failed: Execution of script failed.

4. iBCS and Oracle?

5. Predict drive life by noise it makes?

6. Best Centralized Performance Monitor - Solaris/Linux/AIX/UX/NT-2000..???

7. COMPUTERWORLD: Marc Andreessen predicted a rise in Linux

8. Check out "Author predicts the end of Microsoft" Video Clip at news.com

9. Predicting OS market in 2003?

10. Red Hat predicts death of Solaris

11. Predicting inode densities

12. DELL predicts Win2000 to be big