#!/bin/sh # /etc/init.d/http2email # This file is part of Decimail; see http://decimail.org # (C) 2007 Philip Endecott # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # based on /etc/init.d/skeleton # This should be put in /etc/init.d/http2email # It is then symlinked to from /etc/rc.d/ # To make these symlinks, use update-rc.d: # update-rc.d http2email defaults N # where N determines the order in which things are started, # small numbers first. # 31 seems like a good number - after most other things including mail and # web servers hopefully. # Note that this will not do anything if any symlinks are already # present, i.e. it will not override locally-defined things. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/sbin/http2email # You will need to adjust the options to suit the port numbers that you use: DAEMON_OPTS="-s 2525" NAME=http2email DESC="Decimail Webmail HTTP-to-IMAP/SMTP Proxy" # Complain if daemon is not present if test \! -x $DAEMON then echo "$DAEMON not found / not executable" 1>&2 exit 1 fi set -e ulimit -c unlimited case "$1" in start) echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --chuid nobody --oknodo --exec $DAEMON -- $DAEMON_OPTS echo "." ;; stop) echo -n "Stopping $DESC: $NAME" start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --oknodo echo "." ;; #reload) # # If the daemon can reload its config files on the fly # for example by sending it SIGHUP, do it here. # (http2email currently can't) # # If the daemon responds to changes in its config file # directly anyway, make this a do-nothing entry. # # echo -n "Reloading $DESC configuration..." # start-stop-daemon --stop --signal 1 --quiet --pidfile \ # /var/run/$NAME.pid --exec $DAEMON # echo "done." #;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # echo -n "Restarting $DESC: $NAME" start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --oknodo sleep 1 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --oknodo --exec $DAEMON -- $DAEMON_OPTS echo "." ;; *) N=/etc/init.d/$NAME # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0