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