Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Here's the skinny -- I have a ksh script that does a check for an error condition every couple hours. If it finds the error, I have it break its loop, mail out the warning, then call itself with a parameter to continue scanning.
So...
#!/usr/bin/ksh
while [[ condition ok ]]
do
check for bad thing
done
mailx -s "Bad bad things" blah@blah.com
/usr/scripts/thisfile.ksh $someparam
exitAnd I launch it with nohup thisfile.ksh &
my problem is that each time the error condition occurs, it launches correctly, but the launch of the new instance of the script doesn't kill off the original one, so I have 2 or more thisfile.ksh running, none of which are doing anything except the newest.
Any easy way to either exit into a new script, or force it to launch the new script and continue going so the first script will hit its "exit" line?

Might be better if it didn't break out of its loop, e.g:
while [[ condition ok ]]
do
if bad thing
then
do mail thing
fi
done...or even leave the loop to cron, and just do something like:
if bad thing
then
do mail thing
fi

Hmm the second would require me to leave behind a text file to check for the "ok" condition, but just leaving it in a loop with an if's a definite possibility.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |