summaryrefslogtreecommitdiff
path: root/network/cyrus-imapd/rc.cyrus-imapd
diff options
context:
space:
mode:
authormario <mario@slackverse.org>2010-10-19 20:09:25 +0100
committerMichiel van Wessem <michiel@slackbuilds.org>2010-10-19 20:09:25 +0100
commitb385046138ba68d222573585879492193726affb (patch)
tree2e16f2bcd2010a6e3c68254195a5c0129c820872 /network/cyrus-imapd/rc.cyrus-imapd
parent31444f01c3a08fe385d86afa5de85622d2089ac9 (diff)
downloadslackbuilds-b385046138ba68d222573585879492193726affb.tar.gz
network/cyrus-imapd: Added. (scalable enterprise mail system).
Signed-off-by: Michiel van Wessem <michiel@slackbuilds.org>
Diffstat (limited to 'network/cyrus-imapd/rc.cyrus-imapd')
-rw-r--r--network/cyrus-imapd/rc.cyrus-imapd43
1 files changed, 43 insertions, 0 deletions
diff --git a/network/cyrus-imapd/rc.cyrus-imapd b/network/cyrus-imapd/rc.cyrus-imapd
new file mode 100644
index 0000000000..c148183bbf
--- /dev/null
+++ b/network/cyrus-imapd/rc.cyrus-imapd
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Start/stop/restart the Cyrus IMAP daemon.
+# Written by mario <mario@slackverse.org>.
+
+cyrus_start() {
+ if [ -x /usr/libexec/cyrus/master ]; then
+ if [ -f /var/run/cyrus-master.pid ] && kill -0 $(cat /var/run/cyrus-master.pid) 2> /dev/null; then
+ echo "Cyrus IMAP daemon already running."
+ return
+ fi
+ echo "Starting Cyrus IMAP daemon: /usr/libexec/cyrus/master"
+ /usr/libexec/cyrus/master -d
+ fi
+}
+
+cyrus_stop() {
+ if [ -f /var/run/cyrus-master.pid ]; then
+ echo "Stopping Cyrus IMAP daemon"
+ kill $(cat /var/run/cyrus-master.pid) 2> /dev/null && rm -f /var/run/cyrus-master.pid
+ else
+ echo "Cyrus IMAP daemon already stopped."
+ fi
+}
+
+cyrus_restart() {
+ cyrus_stop
+ sleep 1
+ cyrus_start
+}
+
+case "$1" in
+ start)
+ cyrus_start
+ ;;
+ stop)
+ cyrus_stop
+ ;;
+ restart)
+ cyrus_restart
+ ;;
+ *)
+ echo "usage $0 start|stop|restart"
+esac