Re: email notification when a process ends?
On Wed, Apr 15, 2009 at 01:21:55PM -0500, Zhengquan Zhang wrote:
> On Wed, Apr 15, 2009 at 08:16:23PM +0000, Pedro Insua wrote:
> > On Wed, Apr 15, 2009 at 01:00:25PM -0500, Zhengquan Zhang wrote:
> > > Dear debian users,
> > > I have got a script that does database query running for hours. Is there
> > > any way to send myself an email after the process for the script ends?
> >
> > Hello.
> >
> > You can use 'mail' , in 'bsd-mailx' package.
> >
> > When the process end, you can put..:
> >
> > echo "End" | mail -s "subject text" user
>
> THank you very much, but now the problem is that the process has already
> started and how can I detect its end time?
>
> Regards,
>
Sorry.. I forgot 'sleep'
,----
| while true; do
|
| IDP=$(pidof your_process)
|
| if (( $? == 1 )) ; then
| echo "End your_process with pid:$IDP" | mail -s "subject text" user
| fi
|
| sleep 1
|
| done
`----
--
Porqué loitar e matar, se podes amar e sonhar
/"\
\ / CAMPANHA DA FITA ASCII - CONTRA MAIL HTML
X ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
/ \
Reply to: