]> git.pld-linux.org Git - packages/fetchmail.git/blob - fetchmail.init
- Reads configuration from /etc/fetchmailrc instead of ~/.fetchmailrc.
[packages/fetchmail.git] / fetchmail.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 91 35
4 # description:  Starts and stops the fetchmail daemon used to retrive mail \
5 #               via various protocols (such as POP3 and IMAP4).
6 #
7 # config:       /etc/fetchmailrc
8
9
10 # Source function library.
11 . /etc/rc.d/init.d/functions
12
13 # Source networking configuration.
14 # Get service config - may override defaults
15 [ -f /etc/sysconfig/fetchmail ] && . /etc/sysconfig/fetchmail
16
17 # Get network config
18 [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
19
20 # Check that networking is up.
21 if is_no "${NETWORKING}"; then
22         msg_Network_Down "fetchmail"
23         exit 1
24 fi
25
26 # Check that fetchmailrc exists.
27 [ -f /etc/fetchmailrc ] || exit 0
28
29 # See how we were called.
30 case "$1" in
31   start)
32         if [ ! -f /var/lock/subsys/fetchmail ]; then
33                 msg_starting "fetchmail"
34                 daemon fetchmail -f /etc/fetchmailrc
35                 RETVAL=$?
36                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
37         else
38                 msg_Already_Running fetchmail
39                 exit 1
40         fi
41         ;;
42   stop)
43         if [ -f /var/lock/subsys/fetchmail ]; then
44                 msg_stopping "fetchmail"
45                 killproc fetchmail
46                 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
47         else
48                 msg_Not_Running "fetchmail"
49                 exit 1
50         fi      
51         ;;
52   restart)
53         $0 stop
54         $0 start
55         ;;
56   reload)
57         if [ -f /var/lock/subsys/fetchmail ]; then
58                 msg_show fetchmail
59                 msg_reload
60                 busy
61                 killproc fetchmail -HUP
62                 deltext
63                 ok              
64         else
65                 msg_Not_Running fetchmail
66                 exit 1
67         fi
68         ;;
69   force-reload)
70         # if program allows reloading without stopping
71         $0 reload
72         exit $?
73
74         # or if it doesn't
75         $0 stop && $0 start
76         exit $?
77         ;;
78   status)
79         status fetchmail
80         exit $?
81         ;;
82   *)
83         msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
84         exit 1
85 esac
86
87 exit $RETVAL
This page took 0.071432 seconds and 4 git commands to generate.