]> git.pld-linux.org Git - packages/fetchmail.git/blob - fetchmail.init
- removed all Group fields translations (oure rpm now can handle translating
[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
38                 is_yes $VERBOSE_LOGGING && OPTIONS="-v"
39
40                 daemon fetchmail -d "$POLL_INTERVAL" $OPTIONS -f /etc/fetchmailrc
41                 RETVAL=$?
42                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
43         else
44                 msg_already_running fetchmail
45                 exit 1
46         fi
47         ;;
48   stop)
49         if [ -f /var/lock/subsys/fetchmail ]; then
50                 msg_stopping "fetchmail"
51                 killproc fetchmail
52                 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
53         else
54                 msg_not_running "fetchmail"
55                 exit 1
56         fi      
57         ;;
58   restart)
59         $0 stop
60         $0 start
61         ;;
62   reload)
63         if [ -f /var/lock/subsys/fetchmail ]; then
64                 msg_reloading "fetchmail"
65                 busy
66                 killproc fetchmail -HUP
67                 deltext
68                 ok              
69         else
70                 msg_not_running fetchmail
71                 exit 1
72         fi
73         ;;
74   force-reload)
75         # if program allows reloading without stopping
76         $0 reload
77         exit $?
78
79         # or if it doesn't
80         $0 stop && $0 start
81         exit $?
82         ;;
83   status)
84         status fetchmail
85         exit $?
86         ;;
87   *)
88         msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
89         exit 1
90 esac
91
92 exit $RETVAL
This page took 0.063834 seconds and 3 git commands to generate.