wok-next view dovecot/stuff/init.d/dovecot @ rev 17827
Up: slitaz-doc(4.4.1)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Sun Mar 22 22:32:11 2015 +0100 (2015-03-22) |
parents | f7d5cfb17be3 |
children | 7f188676b59c |
line source
1 #!/bin/sh
2 # /etc/init.d/dovecot : Start, stop and restart Dovecotserver on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SSH server at boot time, just put dovecot 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=dovecot
12 DESC="Dovecot daemon"
13 DAEMON=/usr/sbin/dovecot
14 OPTIONS=$dovecot_OPTIONS
15 PIDFILE=/var/run/dovecot/master.pid
17 if [ ! -d /var/run/dovecot ]; then
18 mkdir -p /var/run/dovecot
19 chown dovecot.dovecot /var/run/dovecot
20 fi
21 case "$1" in
22 start)
23 if active_pidfile $PIDFILE dovecot ; then
24 echo "$NAME already running."
25 exit 1
26 fi
27 echo -n "Starting $DESC: $NAME... "
28 $DAEMON $OPTIONS
29 status
30 ;;
31 stop)
32 if ! active_pidfile $PIDFILE dovecot ; then
33 echo "$NAME is not running."
34 exit 1
35 fi
36 echo -n "Stopping $DESC: $NAME... "
37 kill `cat $PIDFILE`
38 status
39 ;;
40 restart)
41 if ! active_pidfile $PIDFILE dovecot ; then
42 echo "$NAME is not running."
43 exit 1
44 fi
45 echo -n "Restarting $DESC: $NAME... "
46 kill `cat $PIDFILE`
47 sleep 2
48 $DAEMON $OPTIONS
49 status
50 ;;
51 *)
52 echo ""
53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
54 echo ""
55 exit 1
56 ;;
57 esac
59 exit 0