tpop3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tpop3d-discuss] A Debian /etc/init.d/tpop3d


From: Paul Makepeace
Subject: [tpop3d-discuss] A Debian /etc/init.d/tpop3d
Date: Sat, 5 Oct 2002 23:45:21 +0100
User-agent: Mutt/1.4i

I just started using tpop3d on Debian GNU/Linux so threw this together.
Maybe it'll be useful for other Debian folk before tpop3d is packaged.

The --retry 2 is a rough guess. start-stop-daemon(8) explains the
timeout and schedule stuff. On my box, tpop3d closes very fast so so far
this works fine here.

Those using mysql might like to look in /etc/init.d/mysql for how it
watches for mysqld being up (basically: mysqladmin ping and look at $?).
In the comment demonstrating update-rc.d, I set the default order past
mysql so it should always be started after mysql's up anyway.

Note: in keeping with Debian's policy/FHS I have put tpop3d in /usr/sbin
      which would require ./configure --prefix=/usr

Cheers,
Paul


#! /bin/sh
#
# /etc/init.d/tpop3d
# Written by Paul Makepeace <http://paulm.com/> based loosely on
# Debian's /etc/init.d/skeleton

# To create suitable /etc/rc?.d symlinks use
# update-rc.d tpop3d defaults 22 # (22 is after mysql's 20)

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/tpop3d
NAME=tpop3d
DESC="tpop3d POP3 daemon"
CONF="/etc/tpop3d.conf"
SELF=/etc/init.d/$NAME

test -x $DAEMON || exit 0
if ! test -e $CONF; then
        echo "Please create a tpop3d $CONF configuration first; see 
tpop3d.conf(5)"
        exit 1;
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        if start-stop-daemon --start --quiet --exec $DAEMON --name $NAME
        then
                echo "."
        else
                echo " already running."
        fi
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        if start-stop-daemon --stop --retry 2 --quiet --exec $DAEMON --name 
$NAME
        then
                echo "."
        else
                echo " not running."
        fi
        ;;
  reload|force-reload)
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON --name $NAME
        echo "done."
        ;;
  restart)
        $SELF stop
        $SELF start
        ;;
  *)
        echo "Usage: $SELF {start|stop|restart|reload|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

-- 
Paul Makepeace ....................................... http://paulm.com/

"If I follow your example, then you're at a technical meeting without
 your laptop."
   -- http://paulm.com/toys/surrealism/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]