]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added example init.d/dovecot script.
authorTimo Sirainen <tss@iki.fi>
Fri, 1 May 2009 21:15:31 +0000 (17:15 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 1 May 2009 21:15:31 +0000 (17:15 -0400)
--HG--
branch : HEAD

doc/Makefile.am
doc/dovecot-initd.sh [new file with mode: 0644]

index a3436056afecf2eb850388cfa2bedf3b447eb34d..44dfb390c0bea5a36fb86842bf62473edfec60f6 100644 (file)
@@ -13,6 +13,7 @@ doc_DATA = \
        securecoding.txt
 
 EXTRA_DIST = \
+       dovecot-initd.sh \
        mkcert.sh \
        dovecot-openssl.cnf \
        solr-schema.xml \
diff --git a/doc/dovecot-initd.sh b/doc/dovecot-initd.sh
new file mode 100644 (file)
index 0000000..7070083
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# Example /etc/init.d/dovecot script. Change DAEMON if necessary.
+# License is public domain.
+
+DAEMON=/usr/local/sbin/dovecot
+
+test -x $DAEMON || exit 1
+set -e
+
+base_dir=`$DAEMON -a|grep '^base_dir: '|sed 's/^base_dir: //'`
+pidfile=$base_dir/master.pid
+
+if test -f $pidfile; then
+  running=yes
+else
+  running=no
+fi
+
+case "$1" in
+  start)
+    echo -n "Starting Dovecot"
+    $DAEMON
+    echo "."
+    ;;
+  stop)
+    if test $running = yes; then
+      echo "Stopping Dovecot"
+      kill `cat $pidfile`
+      echo "."
+    else
+      echo "Dovecot is already stopped."
+    fi
+    ;;
+  reload)
+    if test $running = yes; then
+      echo -n "Reloading Dovecot configuration"
+      kill -HUP `cat $pidfile`
+      echo "."
+    else
+      echo "Dovecot isn't running."
+    fi
+    ;;
+  restart|force-reload)
+    echo -n "Restarting Dovecot"
+    if test $running = yes; then
+      kill `cat $pidfile`
+      sleep 1
+    fi
+    $DAEMON
+    echo "."
+    ;;
+  *)
+    echo "Usage: /etc/init.d/dovecot {start|stop|reload|restart|force-reload}" >&2
+    exit 1
+    ;;
+esac
+
+exit 0