Operating System - HP-UX
1827858 Members
1638 Online
109969 Solutions
New Discussion

Email when script is executed .. this one ..

 
SOLVED
Go to solution
someone_4
Honored Contributor

Email when script is executed .. this one ..

We have a restart script that a 3rd party software vendor has written. Is there a way that I can write a script that will email us when the restart script is ran. With out having to edit their script.

thanks

RIchard
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Email when script is executed .. this one ..

Hi Richard:

My attempt at doing this would be a wrapper script e.g. Restart.sh which calls the real script (restart.sh):

#!/usr/bin/sh
USERADDRESS="me@somewhere.com"
restart.sh $*
STATUS=$?
echo "restart.sh returned status ${STATUS} | mail ${USERADDRESS}
exit $STATUS

You can obviously use the mail program of your choice (xmain,elm,etc.)
If you like you could actually name both scripts 'restart.sh' but have the wrapper earlier in the PATH and do an absolute path to the 'real' restart.sh with your wrapper.

Regards, Clay


If it ain't broke, I can fix that.
Sachin Patel
Honored Contributor

Re: Email when script is executed .. this one ..

Hi Richard,
How does this restart script starts? If it is started by you then you can call that script from your script.
If it is starting automatically then you have to find out in which situation it restarts.
If this restart script starts at certain time and change certain files you can check that files and know that script is ran.

Sachin
Is photography a hobby or another way to spend $