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