]> git.pld-linux.org Git - packages/courier-imap.git/blame - courier-imap.init
- unnecessary
[packages/courier-imap.git] / courier-imap.init
CommitLineData
e93af56d 1#!/bin/sh
2# IMAP Daemon
3#
4# chkconfig: 345 80 20
5# description: IMAP Daemon
6
7# Source function library
8. /etc/rc.d/init.d/functions
9
10# Get network config
11. /etc/sysconfig/network
12
1986fe76 13ADDRESS=0.0.0.0
14MAXPERIP=4
15MAXDAEMONS=40
4f7296cb 16MAILDIR="Mail/Maildir"
1986fe76 17TCPDOPTS=
18IMAPDSSLSTART="no"
19
e93af56d 20# Get service config
13686659 21[ -f /etc/sysconfig/courier-imap ] && . /etc/sysconfig/courier-imap
e93af56d 22
23# Check that networking is up.
0838e112 24if is_yes "${NETWORKING}"; then
ac84c9b5 25 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
0838e112 26 msg_network_down "Courier IMAP"
27 exit 1
28 fi
29else
30 exit 0
e93af56d 31fi
32
d5f9e77f 33RETVAL=0
e93af56d 34# See how we were called.
35case "$1" in
36 start)
37 # Check if the service is already running?
38 if [ ! -f /var/lock/subsys/courier-imap ]; then
0e7557ae 39 # start authdaemon, if not running..
40 if [ ! -f /var/lock/subsys/authdaemon -a \
0838e112 41 -x /etc/rc.d/init.d/authdaemon ]; then
42 /etc/rc.d/init.d/authdaemon start
43 RETVAL=$?
44 if [ $RETVAL -ne 0 ]; then
45 msg_starting "Courier IMAP"
46 fail
47 exit 1
48 fi
0e7557ae 49 fi
1986fe76 50 msg_starting "Courier IMAP"
d5f9e77f 51 busy
1986fe76 52 ulimit -d $IMAP_ULIMITD
53 /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
1986fe76 54 `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
55 sed 's/=.*//;s/^/export /;s/$/;/'` \
56 /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
28a49797 57 -stderrlogger=/usr/sbin/courierlogger \
1986fe76 58 -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
03299413 59 -pid=/var/run/imapd.pid $TCPDOPTS $PORTS /usr/sbin/imaplogin \
1986fe76 60 /usr/lib/courier-imap/authlib/authdaemon /usr/bin/imapd $MAILDIR"
61 RETVAL=$?
62 if [ $RETVAL -eq 0 ]; then
63 ok
64 else
65 fail
66 fi
e93af56d 67
1986fe76 68
69 if is_yes "$IMAPDSSLSTART"; then
9eb9878a 70 msg_starting "Courier IMAP (SSL)"
1986fe76 71 /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
03299413 72 IMAP_TLS=1; export IMAP_TLS; \
1986fe76 73 `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
74 sed 's/=.*//;s/^/export /;s/$/;/'`
03299413 75 /usr/lib/courier-imap/couriertcpd -address=$ADDRESS_SSL \
28a49797 76 -stderrlogger=/usr/sbin/courierlogger \
1986fe76 77 -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
78 -pid=/var/run/imapd-ssl.pid $TCPDOPTS \
03299413 79 $PORTS_SSL $COURIERTLS -server -tcpd \
1986fe76 80 /usr/sbin/imaplogin /usr/lib/courier-imap/authlib/authdaemon \
81 /usr/bin/imapd $MAILDIR"
9eb9878a 82 RETVAL=$?
83 if [ $RETVAL -eq 0 ]; then
84 ok
85 else
86 fail
87 fi
e93af56d 88 fi
1986fe76 89 touch /var/lock/subsys/courier-imap
e93af56d 90 else
7ea5697f 91 msg_already_running "Courier IMAP"
e93af56d 92 fi
e93af56d 93 ;;
94 stop)
1986fe76 95 if [ -f /var/lock/subsys/courier-imap ]; then
96 msg_stopping "Courier IMAP"
97 daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd.pid -stop
98 if is_yes "$IMAPDSSLSTART"; then
99 msg_stopping "Courier IMAP (SSL)"
100 daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd-ssl.pid -stop
101 fi
1986fe76 102 rm -f /var/lock/subsys/courier-imap
103 else
104 msg_not_running "Courier IMAP"
1986fe76 105 fi
e93af56d 106 ;;
d5f9e77f 107 restart|force-reload)
e93af56d 108 $0 stop
109 $0 start
d5f9e77f 110 exit $?
e93af56d 111 ;;
112 status)
113 status couriertcpd
d5f9e77f 114 exit $?
e93af56d 115 ;;
116 *)
d5f9e77f 117 msg_usage "$0 {start|stop|restart|force-reload|status}"
118 exit 3
e93af56d 119esac
120
1986fe76 121exit $RETVAL
This page took 0.091178 seconds and 4 git commands to generate.