comparison doc/dovecot-initd.sh @ 9010:c2d55b298ec8 HEAD

Added example init.d/dovecot script.
author Timo Sirainen <tss@iki.fi>
date Fri, 01 May 2009 17:15:31 -0400
parents
children
comparison
equal deleted inserted replaced
9009:4fd7b98bcff9 9010:c2d55b298ec8
1 #!/bin/sh
2
3 # Example /etc/init.d/dovecot script. Change DAEMON if necessary.
4 # License is public domain.
5
6 DAEMON=/usr/local/sbin/dovecot
7
8 test -x $DAEMON || exit 1
9 set -e
10
11 base_dir=`$DAEMON -a|grep '^base_dir: '|sed 's/^base_dir: //'`
12 pidfile=$base_dir/master.pid
13
14 if test -f $pidfile; then
15 running=yes
16 else
17 running=no
18 fi
19
20 case "$1" in
21 start)
22 echo -n "Starting Dovecot"
23 $DAEMON
24 echo "."
25 ;;
26 stop)
27 if test $running = yes; then
28 echo "Stopping Dovecot"
29 kill `cat $pidfile`
30 echo "."
31 else
32 echo "Dovecot is already stopped."
33 fi
34 ;;
35 reload)
36 if test $running = yes; then
37 echo -n "Reloading Dovecot configuration"
38 kill -HUP `cat $pidfile`
39 echo "."
40 else
41 echo "Dovecot isn't running."
42 fi
43 ;;
44 restart|force-reload)
45 echo -n "Restarting Dovecot"
46 if test $running = yes; then
47 kill `cat $pidfile`
48 sleep 1
49 fi
50 $DAEMON
51 echo "."
52 ;;
53 *)
54 echo "Usage: /etc/init.d/dovecot {start|stop|reload|restart|force-reload}" >&2
55 exit 1
56 ;;
57 esac
58
59 exit 0