#!/bin/sh DAEMON="rngd" DAEMON_ARGS="-r /dev/urandom" PID_FILE="/var/run/$DAEMON.pid" start() { echo "Starting $DAEMON..." start-stop-daemon -S -q -x "/usr/sbin/$DAEMON" -- $DAEMON_ARGS } stop() { echo "Stopping $DAEMON..." # This daemon does not exit properly with the default TERM signal unless # it's forced to work by something reading /dev/random. Killing it and # removing its PID file is more straightforward. start-stop-daemon -K -q -s KILL -p "$PID_FILE" -n "$DAEMON" rm -f "$PID_FILE" } case "$1" in start|stop) "$1" ;; restart|reload) stop start ;; *) echo "Usage: $0 {start|stop|restart|reload}" >&2 exit 1 ;; esac