#!/bin/sh -e # Start or stop ASSP (Anti-Spam SMTP Proxy) # # Script by Abey Marquez # v1.0.1 Changed 'force-reload' to force a restart if it can't reload the config. Also changed 'restart' to start the proc if not running. # v1.0.0 I'm not an expert but I tried to make this as LSB compliant as possible. Should work really nice with Ubuntu. ### BEGIN INIT INFO # Provides: ASSP (Anti-Spam SMTP Proxy) # Required-Start: $syslog, $local_fs # Required-Stop: $syslog, $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start or stop ASSP # Description: Start or stop ASSP (Anti-Spam SMTP Proxy) ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin NAME=assp.pl HOME=/usr/share/assp DAEMON=$HOME/$NAME PIDFILE=$HOME/pid INITSCRIPT=/etc/init.d/assp . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting ASSP (Anti-Spam SMTP Proxy)" "assp" start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON 2>&1 > /dev/null --chdir $HOME log_end_msg $? ;; stop) log_daemon_msg "Stopping ASSP (Anti-Spam SMTP Proxy)" "assp" start-stop-daemon --stop --quiet --pidfile $PIDFILE --chdir $HOME log_end_msg $? ;; restart) if [ -f $PIDFILE ]; then $0 stop sleep 1 $0 start else $0 start fi ;; reload) log_action_begin_msg "Reloading ASSP (Anti-Spam SMTP Proxy) configuration" if [ -f $PIDFILE ]; then if kill -1 $(cat $PIDFILE); then log_action_end_msg 0 else log_action_end_msg 1 fi else log_action_end_msg 1 exit 1 fi ;; force-reload) log_action_begin_msg "Reloading ASSP (Anti-Spam SMTP Proxy) configuration" if [ -f $PIDFILE ]; then if kill -1 $(cat $PIDFILE); then log_action_end_msg 0 else log_action_cont_msg "Could not reload configuration. Restarting" $0 restart fi else log_action_cont_msg "Could not reload configuration. Restarting" $0 restart fi ;; status) status_of_proc $DAEMON "ASSP (Anti-Spam SMTP Proxy)" ;; *) log_action_msg "Usage: $INITSCRIPT {start|stop|restart|reload|force-reload|status}" exit 1 ;; esac exit 0