]> git.pld-linux.org Git - packages/cyrus-imapd.git/blob - cyrus-imapd.init
- more missing libtools
[packages/cyrus-imapd.git] / cyrus-imapd.init
1 #!/bin/sh
2 #
3 # cyrus-imapd   cyrus-imapd IMAP Daemon
4 #
5 # chkconfig:    345 85 15
6 #
7 # description:  cyrus-imapd
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20                 msg_network_down "Cyrus IMAP Daemon"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 start() {
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/cyrus-imapd ]; then
30                 msg_starting "Cyrus IMAP Daemon"
31                 /usr/lib/cyrus/cyrus-master &
32                 if ps -C cyrus-master >/dev/null 2>&1; then
33                         RETVAL=$?
34                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-imapd
35                         ok
36                 else
37                         fail
38                 fi
39         else
40                 msg_already_running "Cyrus IMAPD"
41         fi
42 }
43
44 stop() {
45         # Stop daemons.
46         if [ -f /var/lock/subsys/cyrus-imapd ]; then
47                 msg_stopping "Cyrus IMAP Daemon"
48                 killproc cyrus-master
49                 rm -f /var/lock/subsys/cyrus-imapd
50         else
51                 msg_not_running "Cyrus IMAP Daemon"
52         fi
53 }
54
55 condrestart() {
56         if [ -f /var/lock/subsys/cyrus-imapd ]; then
57                 stop
58                 start
59         else
60                 msg_not_running "Cyrus IMAP Daemon"
61                 RETVAL=$1
62         fi
63 }
64
65 RETVAL=0
66 # See how we were called.
67 case "$1" in
68   start)
69         start
70         ;;
71   stop)
72         stop
73         ;;
74   restart)
75         stop
76         start
77         ;;
78   try-restart)
79         condrestart 0
80         ;;
81   force-reload)
82         condrestart 7
83         ;;
84   status)
85         status cyrus-master
86         RETVAL=$?
87         ;;
88   *)
89         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
90         exit 3
91 esac
92
93 exit $RETVAL
This page took 0.120267 seconds and 3 git commands to generate.