#!/bin/bash # # /etc/rc.d/init.d/dovecot # # Starts the dovecot daemon # # chkconfig: - 65 35 # description: Dovecot Imap Server # processname: dovecot # config: /etc/dovecot.conf ### BEGIN INIT INFO # Provides: dovecot # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Should-Start: $remote_fs # Should-Stop: $remote_fs # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: start and stop Dovecot Imap server # Description: Dovecot is an IMAP server for Linux/UNIX-like systems, # written with security primarily in mind. It also contains # a small POP3 server. ### END INIT INFO # Source function library. . /etc/init.d/functions RETVAL=0 prog="Dovecot Imap" start() { [ -x /usr/sbin/dovecot ] || exit 5 [ -f /etc/dovecot.conf ] || exit 6 echo -n $"Starting $prog: " daemon /usr/sbin/dovecot RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot echo } stop() { echo -n $"Stopping $prog: " killproc /usr/sbin/dovecot RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dovecot echo } # # See how we were called. # case "$1" in start) start ;; stop) stop ;; reload|restart) stop start RETVAL=$? ;; condrestart) if [ -f /var/lock/subsys/dovecot ]; then stop start fi ;; status) status /usr/sbin/dovecot RETVAL=$? ;; *) echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}" exit 2 esac exit $RETVAL