#!/bin/sh DAEMON=/usr/sbin/pound OPTIONS= PID= test -r /etc/default/pound && . /etc/default/pound # 0 - running # 1 - not running pound_is_running() { PID=$(pidof $DAEMON) test -n "$PID" } pound_status() { if pound_is_running; then echo "$DAEMON is running (pid $PID)" exit 0 else echo "$DAEMON is not running" exit 1 fi } pound_start() { if pound_is_running; then echo "$DAEMON is already running (pid $PID)" else $DAEMON $OPTIONS fi } pound_stop() { if pound_is_running; then kill -TERM $PID else echo "$DAEMON is not running" fi } case "$1" in start) pound_start;; stop) pound_stop;; restart) pound_stop pound_start;; status) pound_status;; *) echo "usage: $0 start|stop|restart|status" esac