]> Pileus Git - ~andy/fetchmail/blob - contrib/getmail
Merge branch 'legacy_63'
[~andy/fetchmail] / contrib / getmail
1 #------------------------------------------------------------------------------
2 #
3 #               GetMail - Fetchmail Daemon Controlling Script
4 #
5 #             1999 by Thomas Nesges <ThomaNesges@TNT-Computer.de>
6 #
7 #------------------------------------------------------------------------------
8
9 #------------------------------------------------------------------------------
10 # GetMail starts/stops fetchmail in daemon mode and logs all actions to
11 # /var/log/fetchmail.log. Output is done by tailing the logfile.
12 #
13 # Sendmail/Fetchmail has to be installed, and your fetchmailrc has to be
14 # correctly configured. The option 'got' and 'goth' require a correctly
15 # installed GotMail. If you didn't install it in /usr/local/gotmail you 
16 # must change the path given.
17 #
18 # If you have any changes/corrections in the script, please send me email.
19 #------------------------------------------------------------------------------
20
21 #!/bin/sh
22
23 case "$1" in
24   start)
25    sendmail -q
26    date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
27    fetchmail -d 1 -L /var/log/fetchmail.log &
28    tail -f /var/log/fetchmail.log
29    ;;
30   stop)
31    fetchmail -q
32    date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ stoped >> /var/log/fetchmail.log
33    ;;
34   fetch)
35    date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
36    fetchmail -d 1 -L /var/log/fetchmail.log &
37    tail -f /var/log/fetchmail.log
38    ;;
39   status)
40    tail -f /var/log/fetchmail.log
41    ;;
42   got)
43    /usr/local/gotmail/gotmail
44    ;;
45   goth)
46    /usr/local/gotmail/gotmail html
47    ;;
48   send)
49    /sendmail -q
50    ;;
51   clear)
52    fetchmail -q
53    rm /var/log/fetchmail.log
54    ;;
55   -v)
56    echo 'getmail version: 0.0.1'
57    ;;
58   *)
59    echo
60    echo 'Usage: getmail option'
61    echo
62    echo 'options:'
63    echo ' clear  - stops fetchmail and kills the logfile' 
64    echo ' fetch  - starts fetchmail'
65    echo ' got    - starts gotmail'
66    echo ' goth   - starts gotmail html'
67    echo ' send   - sends all mail from the mailqueue'
68    echo ' status - tails the logfile'
69    echo ' start  - starts fetchmail and tails the logfile'
70    echo ' stop   - stops fetchmail'
71    echo ' -v     - print the version number'
72    echo 
73 esac