#!/bin/bash ### BEGIN INIT INFO # Provides: mantis-smtp # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop Mantis SMTP gateway server # Description: Mantis SMTP Server is a SMTP Gateway for Mantis # bug tracker ### END INIT INFO # mantis-smtp Startup script for the Mantis SMTP Server # # chkconfig: 2345 80 30 # description: Mantis SMTP Server is a SMTP Gateway for Mantis # bug tracker # processname: mantis-smtp # config: /etc/sysconfig/mantis-smtp # config: /etc/mantis-smtp.conf # pidfile: /var/run/mantis-smtp.pid # Source function library. if [ -f /etc/redhat-release ] then . /etc/rc.d/init.d/functions elif [ -f /etc/debian_version ] then . /lib/lsb/init-functions fi prog="Mantis SMTP Server" pidfile=/var/run/mantis-smtp.pid mantis_smtp_bin=/usr/bin/mantis-smtp configfile=/etc/mantis-smtp.conf logfile=/var/log/mantis-smtp.log OPTIONS="-c $configfile --daemon --pid ${pidfile} -l $logfile -H 127.0.0.1 -p 10029" STOP_TIMEOUT=10 if [ -f /etc/redhat-release -a -f /etc/sysconfig/mantis-smtp ] then . /etc/sysconfig/mantis-smtp elif [ -f /etc/debian_version ] then . /etc/default/mantis-smtp fi start() { if [ -f /etc/redhat-release ] then echo -n $"Starting $prog: " daemon --pidfile=${pidfile} $mantis_smtp_bin $OPTIONS echo elif [ -f /etc/debian_version ] then log_daemon_msg "Starting $prog" $( basename $mantis_smtp_bin ) start-stop-daemon --start --quiet --pidfile ${pidfile} --exec $mantis_smtp_bin -- $OPTIONS log_end_msg $? fi } stop() { if [ -f /etc/redhat-release ] then echo -n $"Stopping $prog: " killproc -p ${pidfile} -d ${STOP_TIMEOUT} $mantis_smtp_bin [ $? = 0 ] && rm -f ${pidfile} echo elif [ -f /etc/debian_version ] then log_daemon_msg "Stopping $prog" $( basename $mantis_smtp_bin ) start-stop-daemon --stop --quiet --pidfile ${pidfile} log_end_msg $? fi } show_status() { if [ -f /etc/redhat-release ] then status -p ${pidfile} $mantis_smtp_bin elif [ -f /etc/debian_version ] then status_of_proc -p ${pidfile} $( basename $mantis_smtp_bin ) "$prog" fi } case "$1" in start) start ;; stop) stop ;; status) show_status ;; restart|reload|force-reload) stop start ;; condrestart|cond-restart) if [ -f ${pidfile} ] ; then stop start fi ;; *) echo $"Usage: $prog {start|stop|restart|force-reload|condrestart|reload|status}" exit 1 esac