]> git.pld-linux.org Git - packages/fetchmail.git/blame - fetchmail.init
- force to use openssl >= 0.9.7, idea by kloczek
[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
eaf9e23f 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"
df30b99a 37
38 is_yes $VERBOSE_LOGGING && OPTIONS="-v"
39
40 daemon fetchmail -d "$POLL_INTERVAL" $OPTIONS -f /etc/fetchmailrc
b91b49cd 41 RETVAL=$?
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
43 else
eaf9e23f 44 msg_already_running fetchmail
b91b49cd 45 exit 1
46 fi
47 ;;
3681cede 48 stop)
1ad998f9 49 if [ -f /var/lock/subsys/fetchmail ]; then
f307ac5f 50 msg_stopping "fetchmail"
b91b49cd 51 killproc fetchmail
52 rm -f /var/lock/subsys/fetchmail >/dev/null 2>&1
53 else
eaf9e23f 54 msg_not_running "fetchmail"
b91b49cd 55 exit 1
56 fi
57 ;;
3681cede 58 restart)
b91b49cd 59 $0 stop
3681cede 60 $0 start
b91b49cd 61 ;;
62 reload)
63 if [ -f /var/lock/subsys/fetchmail ]; then
e5c4b2fc 64 msg_reloading "fetchmail"
b91b49cd 65 busy
66 killproc fetchmail -HUP
67 deltext
68 ok
69 else
eaf9e23f 70 msg_not_running fetchmail
b91b49cd 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 $?
3681cede 82 ;;
b91b49cd 83 status)
84 status fetchmail
85 exit $?
86 ;;
3681cede 87 *)
eaf9e23f 88 msg_usage "$0 {start|stop|status|restart|reload|force-reload}"
b91b49cd 89 exit 1
3681cede 90esac
91
b91b49cd 92exit $RETVAL
This page took 0.098174 seconds and 4 git commands to generate.