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