]> git.pld-linux.org Git - packages/courier-imap.git/blame - courier-imap.init
- following imap/Changelog:
[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
1986fe76 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
1986fe76 34 msg_starting "Courier IMAP"
35 ulimit -d $IMAP_ULIMITD
36 /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
37 IMAP_STARTTLS=$POP3DSTARTTLS ; export POP3_STARTTLS ; \
38 `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
39 sed 's/=.*//;s/^/export /;s/$/;/'` \
40 /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
41 -stderrlogger=/usr/lib/courier-imap/logger \
42 -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
43 -pid=/var/run/imapd.pid $TCPDOPTS 143 /usr/sbin/imaplogin \
44 /usr/lib/courier-imap/authlib/authdaemon /usr/bin/imapd $MAILDIR"
45 RETVAL=$?
46 if [ $RETVAL -eq 0 ]; then
47 ok
48 else
49 fail
50 fi
e93af56d 51
1986fe76 52
53 if is_yes "$IMAPDSSLSTART"; then
9eb9878a 54 msg_starting "Courier IMAP (SSL)"
1986fe76 55 /usr/bin/env - /bin/sh -c " . /etc/sysconfig/courier-imap ; \
56 IMAP_TLS=1; export POP3_TLS; \
57 `sed -n '/^#/d;/=/p' </etc/sysconfig/courier-imap | \
58 sed 's/=.*//;s/^/export /;s/$/;/'`
59 /usr/lib/courier-imap/couriertcpd -address=$ADDRESS \
60 -stderrlogger=/usr/lib/courier-imap/logger \
61 -maxprocs=$MAXDAEMONS -maxperip=$MAXPERIP \
62 -pid=/var/run/imapd-ssl.pid $TCPDOPTS \
63 993 /usr/bin/couriertls -server -tcpd \
64 /usr/sbin/imaplogin /usr/lib/courier-imap/authlib/authdaemon \
65 /usr/bin/imapd $MAILDIR"
9eb9878a 66 RETVAL=$?
67 if [ $RETVAL -eq 0 ]; then
68 ok
69 else
70 fail
71 fi
e93af56d 72 fi
1986fe76 73 touch /var/lock/subsys/courier-imap
e93af56d 74 else
1986fe76 75 msg_Already_Running "Courier IMAP"
f26425db 76 exit 1
e93af56d 77 fi
e93af56d 78 ;;
79 stop)
1986fe76 80 if [ -f /var/lock/subsys/courier-imap ]; then
81 msg_stopping "Courier IMAP"
82 daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd.pid -stop
83 if is_yes "$IMAPDSSLSTART"; then
84 msg_stopping "Courier IMAP (SSL)"
85 daemon /usr/lib/courier-imap/couriertcpd -pid=/var/run/imapd-ssl.pid -stop
86 fi
87 RETVAL=$?
88 rm -f /var/lock/subsys/courier-imap
89 else
90 msg_not_running "Courier IMAP"
91 exit 1
92 fi
e93af56d 93 ;;
94 restart|reload)
95 $0 stop
96 $0 start
97 ;;
98 status)
99 status couriertcpd
100 ;;
101 *)
f26425db 102 msg_Usage "$0 {start|stop|restart|reload|status}"
e93af56d 103 exit 1
104esac
105
1986fe76 106exit $RETVAL
e93af56d 107
This page took 0.177095 seconds and 4 git commands to generate.