]> git.pld-linux.org Git - packages/fetchmail.git/blame - fetchmail.init
- updated to 5.8.10.
[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
f307ac5f 9
3681cede 10# Source function library.
11. /etc/rc.d/init.d/functions
12
13# Source networking configuration.
b91b49cd 14# Get service config - may override defaults
15[ -f /etc/sysconfig/fetchmail ] && . /etc/sysconfig/fetchmail
3681cede 16
60aaf401
SZ
17# defaults
18[ -z "$POLL_INTERVAL" ] && POLL_INTERVAL=300
19
f307ac5f 20# Get network config
21[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
22
3681cede 23# Check that networking is up.
b91b49cd 24if is_no "${NETWORKING}"; then
f307ac5f 25 msg_Network_Down "fetchmail"
b91b49cd 26 exit 1
27fi
3681cede 28
29# Check that fetchmailrc exists.
30[ -f /etc/fetchmailrc ] || exit 0
31
32# See how we were called.
33case "$1" in
34 start)
b91b49cd 35 if [ ! -f /var/lock/subsys/fetchmail ]; then
f307ac5f 36 msg_starting "fetchmail"
60aaf401 37 daemon fetchmail -d "$POLL_INTERVAL" -f /etc/fetchmailrc
b91b49cd 38 RETVAL=$?
39 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
40 else
b91b49cd 41 msg_Already_Running fetchmail
42 exit 1
43 fi
44 ;;
3681cede 45 stop)
1ad998f9 46 if [ -f /var/lock/subsys/fetchmail ]; then
f307ac5f 47 msg_stopping "fetchmail"
b91b49cd 48 killproc fetchmail
49 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
50 else
f307ac5f 51 msg_Not_Running "fetchmail"
b91b49cd 52 exit 1
53 fi
54 ;;
3681cede 55 restart)
b91b49cd 56 $0 stop
3681cede 57 $0 start
b91b49cd 58 ;;
59 reload)
60 if [ -f /var/lock/subsys/fetchmail ]; then
e5c4b2fc 61 msg_reloading "fetchmail"
b91b49cd 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 $?
3681cede 79 ;;
b91b49cd 80 status)
81 status fetchmail
82 exit $?
83 ;;
3681cede 84 *)
b91b49cd 85 msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
86 exit 1
3681cede 87esac
88
b91b49cd 89exit $RETVAL
This page took 0.0418539999999999 seconds and 4 git commands to generate.