mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-26 22:06:35 +01:00
44 lines
902 B
Text
44 lines
902 B
Text
|
#!/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
|