]> git.pld-linux.org Git - packages/fetchmail.git/blob - fetchmail.init
- updated gettext BR
[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_yes "${NETWORKING}"; then
25         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
26                 msg_network_down "fetchmail"
27                 exit 1
28         fi
29 else
30         exit 0
31 fi
32
33 # Check that fetchmailrc exists.
34 [ -f /etc/fetchmailrc ] || exit 0
35
36 start() {
37         if [ ! -f /var/lock/subsys/fetchmail ]; then
38                 msg_starting "fetchmail"
39
40                 is_yes $VERBOSE_LOGGING && OPTIONS="-v"
41
42                 daemon fetchmail -d "$POLL_INTERVAL" $OPTIONS -f /etc/fetchmailrc
43                 RETVAL=$?
44                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
45         else
46                 msg_already_running fetchmail
47         fi
48 }
49
50 stop() {
51         if [ -f /var/lock/subsys/fetchmail ]; then
52                 msg_stopping "fetchmail"
53                 killproc fetchmail
54                 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
55         else
56                 msg_not_running "fetchmail"
57         fi
58 }
59
60 RETVAL=0
61 # See how we were called.
62 case "$1" in
63   start)
64         start
65         ;;
66   stop)
67         stop
68         ;;
69   restart)
70         stop
71         start
72         ;;
73   reload|force-reload)
74         if [ -f /var/lock/subsys/fetchmail ]; then
75                 msg_reloading "fetchmail"
76                 killproc fetchmail -HUP
77                 RETVAL=$?
78         else
79                 msg_not_running fetchmail
80                 exit 7
81         fi
82         ;;
83   status)
84         status fetchmail
85         exit $?
86         ;;
87   *)
88         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
89         exit 3
90 esac
91
92 exit $RETVAL
This page took 0.051867 seconds and 3 git commands to generate.