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