wok view cyrus-imapd/stuff/etc/init.d/cyrus-imapd @ rev 1290

Add slitaz-loram-http
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Aug 21 11:00:26 2008 +0000 (2008-08-21)
parents
children 992291a415ab
line source
1 #!/bin/sh
2 # /etc/init.d/cyrus-imapd : Start, stop and restart IMAP server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start IMAP server at boot time, just put cyrus-imapd in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=cyrus-imapd
12 DESC="IMAP server"
13 DAEMON=/usr/cyrus/bin/master
14 OPTIONS=$CYRUS_OPTIONS
15 PIDFILE=/var/run/cyrus.master.pid
16 [ -n "$OPTIONS" ] || OPTIONS="-d -p $PIDFILE"
18 case "$1" in
19 start)
20 if [ -f $PIDFILE ] ; then
21 echo "$NAME already running."
22 exit 1
23 fi
24 if ! pidof saslauthd > /dev/null; then
25 /etc/init.d/cyrus-sasl start
26 fi
27 echo -n "Starting $DESC: $NAME... "
28 $DAEMON $OPTIONS
29 status
30 sleep 2
31 ;;
32 stop)
33 if [ ! -f $PIDFILE ] ; then
34 echo "$NAME is not running."
35 exit 1
36 fi
37 echo -n "Stopping $DESC: $NAME... "
38 kill `cat $PIDFILE`
39 ps x | grep -q `cat $PIDFILE` || rm -f $PIDFILE
40 status
41 ;;
42 restart)
43 if [ ! -f $PIDFILE ] ; then
44 echo "$NAME is not running."
45 exit 1
46 fi
47 echo -n "Restarting $DESC: $NAME... "
48 kill `cat $PIDFILE`
49 if ps x | grep -q `cat $PIDFILE`; then
50 false
51 else
52 rm -f $PIDFILE
53 sleep 2
54 $DAEMON $OPTIONS
55 fi
56 status
57 ;;
58 *)
59 echo ""
60 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
61 echo ""
62 exit 1
63 ;;
64 esac
66 exit 0