[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: email notification when a process ends?



> ,----
> |   while true; do
> | 
> |     IDP=$(pidof your_process)

so the IDP should now be the process ID.


> | 
> |     if (( $? == 1 )) ; then

Could you explain $? ==1 abit? I am sorry I am not familiar with this.

> |       echo "End your_process with pid:$IDP" | mail -s "subject text" user
> |     fi   
> |
> |     sleep 1
> | 
> |   done
> `----

I have 

ls -ef|grep nightly

zhengquan    16041 13150  0 Apr14 ?        00:00:00 /bin/sh /home/zhengquan/downloads/nightly.sh

basically the database query is a line in nightly.sh

psql $DLDB -a -H -f queries.sql  -o $REPORTDIR/queries.html.new 

the processes associate with it is
postgres  7123 11144 64 01:55 ?        07:38:20 postgres: craig downloads [local] SELECT

and 
craig    15954 16041  0 01:55 ?        00:00:00 psql downloads -a -H -f queries.sql -o /var/www/internal/downloads/queries.html.new

also 
I did
'pidof night.sh' but it returned nothing? 

Thanks and Regards,

-- 
Zhengquan


Reply to: