#!/bin/sh DOVECOT=/usr/syno/mailstation/sbin/dovecot StartDaemons() { echo "Starting Dovecot..." $DOVECOT } StopDaemons() { dovecot_base=`$DOVECOT -a|grep '^base_dir: '|sed 's/^base_dir: //'` dovecot_pid=${dovecot_base}master.pid if [ -f $dovecot_pid ]; then echo "Stopping Dovecot..." kill `cat $dovecot_pid` fi } case "$1" in start) StartDaemons ;; stop) StopDaemons ;; restart) StopDaemons sleep 1 StartDaemons ;; status) exit 1 ;; *) echo "Usage: $0 {start|stop|restart|status}" >&2 exit 1 ;; esac exit 0