]> git.pld-linux.org Git - packages/courier-imap.git/blame - courier-imap-authdaemon.init
- security note (no fixes known, 3.0.0 has this part of code mostly rewritten)
[packages/courier-imap.git] / courier-imap-authdaemon.init
CommitLineData
f9ae12f0 1#!/bin/sh
2# IMAP Auth Daemon
3#
4# chkconfig: 345 80 20
5# description: IMAP Auth Daemon
6
7# Source function library
8. /etc/rc.d/init.d/functions
9
10# Get network config
11. /etc/sysconfig/network
12
13METHOD="plain"
14
15[ -f /etc/sysconfig/authdaemon ] && . /etc/sysconfig/authdaemon
16
17# Check that networking is up.
18if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20 msg_network_down "Courier IMAP - Authdaemon"
21 exit 1
22 fi
23else
24 exit 0
25fi
26
27RETVAL=0
28# See how we were called.
29case "$1" in
30 start)
31 # Check if the service is already running?
32 if [ ! -f /var/lock/subsys/authdaemon ]; then
33 msg_starting "Courier IMAP - Authdaemon"
34 daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD start
35 RETVAL=$?
36 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/authdaemon
37 else
38 msg_already_running "Courier IMAP - Authdaemon"
39 fi
40 ;;
41 stop)
42 if [ -f /var/lock/subsys/authdaemon ]; then
43 msg_stopping "Courier IMAP - Authdaemon"
44 daemon /usr/lib/courier-imap/authlib/authdaemond.$METHOD stop
45 rm -f /var/lock/subsys/authdaemon
46 else
47 msg_not_running "Courier IMAP - Authdaemon"
48 fi
49 ;;
50 restart|force-reload)
51 # restart related services, if running..
52 if [ -f /var/lock/subsys/courier-mta -a \
53 -x /etc/rc.d/init.d/courier-mta ]; then
54 /etc/rc.d/init.d/courier-mta stop
55 crun=1
56 fi
57 if [ -f /var/lock/subsys/courier-imap -a \
58 -x /etc/rc.d/init.d/courier-imap ]; then
59 /etc/rc.d/init.d/courier-imap stop
60 imaprun=1
61 fi
62 if [ -f /var/lock/subsys/courier-pop3 -a \
63 -x /etc/rc.d/init.d/courier-pop3 ]; then
64 /etc/rc.d/init.d/courier-pop3 stop
65 poprun=1
66 fi
67 $0 stop
68 $0 start
69 RETVAL=$?
70 [ "$imaprun" -eq 1 ] && /etc/rc.d/init.d/courier-imap start
71 [ "$poprun" -eq 1 ] && /etc/rc.d/init.d/courier-pop3 start
72 [ "$crun" -eq 1 ] && /etc/rc.d/init.d/courier-mta start
73 unset crun
74 unset poprun
75 unset imaprun
76 ;;
77 status)
78 status authdaemond.$METHOD
79 exit $?
80 ;;
81 *)
82 msg_usage "$0 {start|stop|restart|force-reload|status}"
83 exit 3
84 ;;
85esac
86
87exit $RETVAL
This page took 0.032333 seconds and 4 git commands to generate.