]> git.pld-linux.org Git - packages/fetchmail.git/blame - fetchmail.init
- updated to 5.3.4,
[packages/fetchmail.git] / fetchmail.init
CommitLineData
3681cede 1#!/bin/sh
2#
3# chkconfig: 345 91 35
b91b49cd 4# description: Starts and stops the fetchmail daemon used to retrive mail \
5# via various protocols (such as POP3 and IMAP4).
3681cede 6#
7# config: /etc/fetchmailrc
8
3681cede 9# Source function library.
10. /etc/rc.d/init.d/functions
11
12# Source networking configuration.
b91b49cd 13# Get service config - may override defaults
14[ -f /etc/sysconfig/fetchmail ] && . /etc/sysconfig/fetchmail
3681cede 15
16# Check that networking is up.
b91b49cd 17if is_no "${NETWORKING}"; then
18 # nls "ERROR: Networking is down. %s can't be run." <service>
19 msg_Network_Down <service>
20 exit 1
21fi
3681cede 22
23# Check that fetchmailrc exists.
24[ -f /etc/fetchmailrc ] || exit 0
25
26# See how we were called.
27case "$1" in
28 start)
b91b49cd 29 if [ ! -f /var/lock/subsys/fetchmail ]; then
30 # show "Starting %s service." fetchmail
31 msg_starting fetchmail
32 daemon fetchmail
33 RETVAL=$?
34 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
35 else
36 # show "%s service is already running." fetchmail
37 msg_Already_Running fetchmail
38 exit 1
39 fi
40 ;;
3681cede 41 stop)
b91b49cd 42 if [ -f /var/lock/subsys/syslogd ]; then
43 msg_stopping fetchmail
44 killproc fetchmail
45 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
46 else
47 # show "%s service is not running." fetchmail
48 msg_Not_Running fetchmail
49 exit 1
50 fi
51 ;;
3681cede 52 restart)
b91b49cd 53 $0 stop
3681cede 54 $0 start
b91b49cd 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 $?
3681cede 77 ;;
b91b49cd 78 status)
79 status fetchmail
80 exit $?
81 ;;
3681cede 82 *)
b91b49cd 83 msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
84 exit 1
3681cede 85esac
86
b91b49cd 87exit $RETVAL
This page took 0.071803 seconds and 4 git commands to generate.