Re: [monitoring-like] would like to be warned when I have mail (fetchmail -c)

2005-09-29 Thread Gerhard Siegesmund
Hello Michael

 It should work if you use just echo, as this is a shell builtin.
 If that 'echo something' is an external command or a pipe you have
 to use 'echo something || exit 1'.
 How exactly does the script look like?

Here is the script:


#!/bin/sh

# Holt sich von fetchmail die Anzahl Mails und gibt diese aus.
#
# Author: Gerhard Siegesmund [EMAIL PROTECTED]

FETCHMAIL='/usr/bin/fetchmail'

while true; do
  $FETCHMAIL -c | sed -e 's/.* \([0-9]*\) messages (\([0-9]*\) seen.*/\1 - 
\2/g' | bc
  sleep 60
done


Any suggestions?

-- 
cu
  --== Jerri ==--
Homepage: http://www.jerri.de/   ICQ: 54160208
Public PGP Key: http://www.jerri.de/jerris_public_key.asc


signature.asc
Description: Digital signature
___
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users


Re: [monitoring-like] would like to be warned when I have mail (fetchmail -c)

2005-09-29 Thread Gerhard Siegesmund
Hello Will

  backtick 1 0 0 my_script.sh
 Why not get rid of the loop in your script and make screen run it
 every X seconds? That will solve your problem (although it doesn't
 really suggest the cause).

I had that before. Problem is, that the call to the imap-server often
takes several seconds. During this time screen freezes while writing
the hardstatusline.

-- 
cu
  --== Jerri ==--
Homepage: http://www.jerri.de/   ICQ: 54160208
Public PGP Key: http://www.jerri.de/jerris_public_key.asc


signature.asc
Description: Digital signature
___
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users


Re: [monitoring-like] would like to be warned when I have mail (fetchmail -c)

2005-09-28 Thread Michael Schroeder
On Wed, Sep 28, 2005 at 11:26:33PM +0200, Gerhard Siegesmund wrote:
 Mhm. There is not much to check. The script basically looks like this:
 
 
 #!/bin/sh
 
 while true; do
   call_command_to_get something (e.g. fetchmail -c)
   echo something
   sleep some time
 done

It should work if you use just echo, as this is a shell builtin.
If that 'echo something' is an external command or a pipe you have
to use 'echo something || exit 1'.

How exactly does the script look like?

Cheers,
  Michael.

-- 
Michael Schroeder   [EMAIL PROTECTED]
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}


___
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users


Re: [monitoring-like] would like to be warned when I have mail (fetchmail -c)

2005-09-27 Thread Gerhard Siegesmund
Hello

I did something similar, but asking an imap-Server for the number of
mails with fetchmail -c. Problem was: The query took several seconds to
succeed, in which time my screen freezed as the hardstatusline was
waiting for the info.

I read the manpage and found backtick 1 0 0 script which is supposed
to start the script and just wait for new messages to stdout to output
them on the hardstatusline. Works great! Except for one thing: The
script doesn't get killed, if the screen is ended. This means I have to
stop the mailcheck-scripts which are created from screen by hand.

Is there anything I can do to automatically stop the started scripts if
the parent-screen is terminated?

 This seems to be a good opportunity to make use of the hardstatus
 and backticks. I agree a script is the right idea; here's how I'd do
 it.
 $ cat ~/bin/screen-checkmail
 #!/bin/sh
 fetchmail -c $OTHER_FETCHMAIL_JIGGERY_POKERY
 [parse fetchmail output reasonably]
 
 $ cat ~/.screenrc
 ...
 backtick 1 60 1 /$HOME/bin/screen-checkmail
 ...
 hardstatus alwayslastline ...%1`...
 Adding a conditional wrapper around your mail checker (eg %?...%?)
 will ensure that you only see your mail alert when your checkmail
 script produces output.

-- 
cu
  --== Jerri ==--
Homepage: http://www.jerri.de/   ICQ: 54160208
Public PGP Key: http://www.jerri.de/jerris_public_key.asc


signature.asc
Description: Digital signature
___
screen-users mailing list
screen-users@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-users