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