email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
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? Thank you very much, -- Zhengquan -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of

Re: email notification when a process ends?

2009-04-15 Thread Pedro Insua
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

Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
On Wed, Apr 15, 2009 at 08:16:23PM +, 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?

Re: email notification when a process ends?

2009-04-15 Thread Jochen Schulz
Zhengquan Zhang: On Wed, Apr 15, 2009 at 08:16:23PM +, Pedro Insua wrote: 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? In another shell: while ps -ef | grep $processname; do

Re: email notification when a process ends?

2009-04-15 Thread Andrei Popescu
On Wed,15.Apr.09, 13:00:25, 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? Easiest would be to put something like echo 'Master, job is done' | mail -s

Re: email notification when a process ends?

2009-04-15 Thread Pedro Insua
On Wed, Apr 15, 2009 at 01:21:55PM -0500, Zhengquan Zhang wrote: On Wed, Apr 15, 2009 at 08:16:23PM +, 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

Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
On Wed, Apr 15, 2009 at 09:29:53PM +0300, Andrei Popescu wrote: On Wed,15.Apr.09, 13:00:25, 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? Easiest

Re: email notification when a process ends?

2009-04-15 Thread Pedro Insua
On Wed, Apr 15, 2009 at 01:21:55PM -0500, Zhengquan Zhang wrote: On Wed, Apr 15, 2009 at 08:16:23PM +, 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

Re: email notification when a process ends?

2009-04-15 Thread H.S.
Andrei Popescu wrote: On Wed,15.Apr.09, 13:00:25, 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? Easiest would be to put something like echo 'Master,

Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
, | 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

Re: email notification when a process ends?

2009-04-15 Thread H.S.
Zhengquan Zhang wrote: , | 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. $? is a bash variable that holds the return value of

Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
, | 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 ` I tested this, it runs great, but it would send me more than one

Re: email notification when a process ends?

2009-04-15 Thread Pedro Insua
On Wed, Apr 15, 2009 at 02:05:56PM -0500, Zhengquan Zhang wrote: , | 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

Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
You must read the ABS-Guide , and other documents abouta shell programming. It's really a good thing. Thank you very much especially for this, I will read it when I have time, Regards, -- Zhengquan -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of

Re: email notification when a process ends?

2009-04-15 Thread Tzafrir Cohen
On Wed, Apr 15, 2009 at 08:40:36PM +, Pedro Insua wrote: 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

Re: email notification when a process ends?

2009-04-15 Thread Spiro Harvey
while ps -ef | grep $processname; do sleep 60; done echo done | \ mail -s subject user But it might be tricky to identify the right process. grepping ps will invariably also return the grep line, so this will hit a false positive. Better to use pgrep rather than ps grep. Using pgrep without

Re: email notification when a process ends?

2009-04-15 Thread Jochen Schulz
Spiro Harvey: while ps -ef | grep $processname; do sleep 60; done echo done | \ mail -s subject user But it might be tricky to identify the right process. grepping ps will invariably also return the grep line, so this will hit a false positive. Better to use pgrep rather than ps grep.

[solved, Thank you!] Re: email notification when a process ends?

2009-04-15 Thread Zhengquan Zhang
-- Zhengquan -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org