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
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
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?
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
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
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
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
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
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,
,
| 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
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
,
| 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
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
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
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
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
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.
--
Zhengquan
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
18 matches
Mail list logo