1#!/bin/sh 2# 3# Author: Simon Horman <horms@verge.net.au> 4# 5### BEGIN INIT INFO 6# Provides: perdition 7# Required-Start: $remote_fs 8# Should-Start: $syslog $named 9# Required-Stop: $remote_fs 10# Should-Stop: $syslog $named 11# Default-Start: 2 3 4 5 12# Default-Stop: 0 1 6 13# Short-Description: POP, IMAP and managesieve proxy 14# Description: Starts perdition to allow proxied POP, IMAP and managesieve access 15### END INIT INFO 16 17# Source function library. 18. /etc/rc.d/init.d/functions 19 20if [ -f /etc/sysconfig/perdition ]; then 21 . /etc/sysconfig/perdition 22fi 23 24# Please do not edit the values below. 25# Rather, please edit /etc/sysconfig/perdition 26RUN_PERDITION="${RUN_PERDITION:=yes}" 27FLAGS="${FLAGS:=}" 28POP3="${POP3:=yes}" 29POP3_FLAGS="${POP3_FLAGS:=}" 30POP3S="${POP3S:=yes}" 31POP3S_FLAGS="${POP3S_FLAGS:=}" 32IMAP4="${IMAP4:=yes}" 33IMAP4_FLAGS="${IMAP4_FLAGS:=}" 34IMAP4S="${IMAP4S:=yes}" 35IMAP4S_FLAGS="${IMAP4S_FLAGS:=}" 36MANAGESIEVE="${MANAGESIEVE:=yes}" 37MANAGESIEVE_FLAGS="${MANAGESIEVE_FLAGS:=}" 38 39if [ "$RUN_PERDITION" != "yes" ]; then 40 exit 0 41fi 42 43# See how we were called. 44case "$1" in 45 start) 46 if [ "$POP3" = "yes" ]; then 47 echo -n "Starting perdition services (POP3): " 48 daemon @prefix@/sbin/perdition.pop3 $FLAGS $POP3_FLAGS 49 touch /var/lock/subsys/perdition.pop3 50 echo 51 fi 52 53 if [ "$POP3S" = "yes" ]; then 54 echo -n "Starting perdition services (POP3S): " 55 daemon @prefix@/sbin/perdition.pop3s $FLAGS $POP3S_FLAGS 56 touch /var/lock/subsys/perdition.pop3s 57 echo 58 fi 59 60 if [ "$IMAP4" = "yes" ]; then 61 echo -n "Starting perdition services (IMAP4): " 62 daemon @prefix@/sbin/perdition.imap4 $FLAGS $IMAP4_FLAGS 63 touch /var/lock/subsys/perdition.imap4 64 echo 65 fi 66 67 if [ "$IMAP4S" = "yes" ]; then 68 echo -n "Starting perdition services (IMAP4S): " 69 daemon @prefix@/sbin/perdition.imaps $FLAGS $IMAP4S_FLAGS 70 touch /var/lock/subsys/perdition.imaps 71 echo 72 fi 73 if [ "$MANAGESIEVE" = "yes" ]; then 74 echo -n "Starting perdition services (MANAGESIEVE): " 75 daemon @prefix@/sbin/perdition.managesieve $FLAGS $MANAGESIEVE_FLAGS 76 touch /var/lock/subsys/perdition.managesieve 77 echo 78 fi 79 ;; 80 status) 81 if [ "$POP3" = "yes" ]; then 82 status perdition.pop3 83 fi 84 if [ "$POP3S" = "yes" ]; then 85 status perdition.pop3s 86 fi 87 if [ "$IMAP4" = "yes" ]; then 88 status perdition.imap4 89 fi 90 if [ "$IMAP4S" = "yes" ]; then 91 status perdition.imaps 92 fi 93 if [ "$MANAGESIEVE" = "yes" ]; then 94 status perdition.imaps 95 fi 96 ;; 97 restart|reload) 98 $0 stop 99 $0 start 100 ;; 101 stop) 102 if [ "$POP3" = "yes" ]; then 103 echo -n "Shutting down perdition services (POP3): " 104 killproc perdition.pop3 105 rm -f /var/lock/subsys/perdition.pop3 106 echo 107 fi 108 109 if [ "$POP3S" = "yes" ]; then 110 echo -n "Shutting down perdition services (POP3S): " 111 killproc perdition.pop3s 112 rm -f /var/lock/subsys/perdition.pop3s 113 echo 114 fi 115 116 if [ "$IMAP4" = "yes" ]; then 117 echo -n "Shutting down perdition services (IMAP4): " 118 killproc perdition.imap4 119 rm -f /var/lock/subsys/perdition.imap4 120 echo 121 fi 122 123 if [ "$IMAP4S" = "yes" ]; then 124 echo -n "Shutting down perdition services (IMAP4S): " 125 killproc perdition.imaps 126 rm -f /var/lock/subsys/perdition.imaps 127 echo 128 fi 129 if [ "$MANAGESIEVE" = "yes" ]; then 130 echo -n "Shutting down perdition services (MANAGESIEVE): " 131 killproc perdition.managesieve 132 rm -f /var/lock/subsys/perdition.managesieve 133 echo 134 fi 135 ;; 136 *) 137 echo "Usage: perdition {start|stop|status|restart|reload}" 138 exit 1 139esac 140 141exit 0 142