]> git.pld-linux.org Git - packages/fetchmail.git/blob - fetchmail.init
- updated to 5.8.8.
[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 # defaults
18 [ -z "$POLL_INTERVAL" ] && POLL_INTERVAL=300
19
20 # Get network config
21 [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
22
23 # Check that networking is up.
24 if is_no "${NETWORKING}"; then
25         msg_Network_Down "fetchmail"
26         exit 1
27 fi
28
29 # Check that fetchmailrc exists.
30 [ -f /etc/fetchmailrc ] || exit 0
31
32 # See how we were called.
33 case "$1" in
34   start)
35         if [ ! -f /var/lock/subsys/fetchmail ]; then
36                 msg_starting "fetchmail"
37                 daemon fetchmail -d "$POLL_INTERVAL" -f /etc/fetchmailrc
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
40         else
41                 msg_Already_Running fetchmail
42                 exit 1
43         fi
44         ;;
45   stop)
46         if [ -f /var/lock/subsys/fetchmail ]; then
47                 msg_stopping "fetchmail"
48                 killproc fetchmail
49                 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
50         else
51                 msg_Not_Running "fetchmail"
52                 exit 1
53         fi      
54         ;;
55   restart)
56         $0 stop
57         $0 start
58         ;;
59   reload)
60         if [ -f /var/lock/subsys/fetchmail ]; then
61                 msg_reloading "fetchmail"
62                 busy
63                 killproc fetchmail -HUP
64                 deltext
65                 ok              
66         else
67                 msg_Not_Running fetchmail
68                 exit 1
69         fi
70         ;;
71   force-reload)
72         # if program allows reloading without stopping
73         $0 reload
74         exit $?
75
76         # or if it doesn't
77         $0 stop && $0 start
78         exit $?
79         ;;
80   status)
81         status fetchmail
82         exit $?
83         ;;
84   *)
85         msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
86         exit 1
87 esac
88
89 exit $RETVAL
This page took 0.090237 seconds and 3 git commands to generate.