aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/getmail
blob: eec5c6fbc135ee2539226611f34e49e75ad7cda4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#------------------------------------------------------------------------------
#
#               GetMail - Fetchmail Daemon Controlling Script
#
#             1999 by Thomas Nesges <ThomaNesges@TNT-Computer.de>
#
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# GetMail starts/stops fetchmail in daemon mode and logs all actions to
# /var/log/fetchmail.log. Output is done by tailing the logfile.
#
# Sendmail/Fetchmail has to be installed, and your fetchmailrc has to be
# correctly configured. The option 'got' and 'goth' require a correctly
# installed GotMail. If you didn't install it in /usr/local/gotmail you 
# must change the path given.
#
# If you have any changes/corrections in the script, please send me email.
#------------------------------------------------------------------------------

#!/bin/sh

case "$1" in
  start)
   sendmail -q
   date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
   fetchmail -d 1 -L /var/log/fetchmail.log &
   tail -f /var/log/fetchmail.log
   ;;
  stop)
   fetchmail -q
   date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ stoped >> /var/log/fetchmail.log
   ;;
  fetch)
   date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
   fetchmail -d 1 -L /var/log/fetchmail.log &
   tail -f /var/log/fetchmail.log
   ;;
  status)
   tail -f /var/log/fetchmail.log
   ;;
  got)
   /usr/local/gotmail/gotmail
   ;;
  goth)
   /usr/local/gotmail/gotmail html
   ;;
  send)
   /sendmail -q
   ;;
  clear)
   fetchmail -q
   rm /var/log/fetchmail.log
   ;;
  -v)
   echo 'getmail version: 0.0.1'
   ;;
  *)
   echo
   echo 'Usage: getmail option'
   echo
   echo 'options:'
   echo ' clear  - stops fetchmail and kills the logfile' 
   echo ' fetch  - starts fetchmail'
   echo ' got    - starts gotmail'
   echo ' goth   - starts gotmail html'
   echo ' send   - sends all mail from the mailqueue'
   echo ' status - tails the logfile'
   echo ' start  - starts fetchmail and tails the logfile'
   echo ' stop   - stops fetchmail'
   echo ' -v     - print the version number'
   echo	
esac