Rewrite to match the irix script.

This commit is contained in:
Tom G. Christensen 2008-04-26 14:57:56 +00:00 committed by tgc
parent 1bfba17d08
commit 388c3f33a6

View File

@ -1,41 +1,49 @@
#!/bin/sh #!/bin/sh
# Script to control prngd start/stop # Script to control prngd start/stop
# History: # Written by Tom G. Christensen <swpkg@jupiterrise.com>
# 01/05-2001 - Tom G. Christensen / tgc
PID=`ps -ef|grep egd-pool|grep -v grep|awk '{ print $2 }'` DESC="prngd"
DESC="PRNGD" PRNGD_BIN=/usr/tgcware/sbin/prngd
POOLDIR=/var/run
POOLFILE=egd-pool
mode=$1 mode=$1
set `/usr/xpg4/bin/id -u` set `/usr/xpg4/bin/id -u`
if [ $1 = "0" ]; then if [ $1 = "0" ]; then
check_pooldir()
{
if [ ! -d $POOLDIR ]; then
mkdir -p $POOLDIR
chmod 755 $POOLDIR
chown root.sys $POOLDIR
fi
}
case $mode in case $mode in
'start' ) if [ -z "$PID" ]; then 'start' )
echo "Starting $DESC" if test -x $PRNGD_BIN; then
/usr/local/sbin/prngd /var/run/egd-pool echo "Starting $DESC"
else check_pooldir
echo "A running $DESC was found, please stop this first" $PRNGD_BIN $POOLDIR/$POOLFILE
fi fi
;; ;;
'stop' ) if [ -n "$PID" ]; then 'stop' )
echo "Stopping $DESC" echo "Stopping $DESC"
kill -TERM $PID $PRNGD_BIN -k $POOLDIR/$POOLFILE >/dev/null 2>&1
else ;;
echo "$DESC already stopped" 'restart')
fi $0 stop
;; $0 start
'restart') $0 stop ;;
$0 start *)
;; echo "Usage: $0 {start|stop|restart}"
*) echo "Usage: $0 {start|stop|restart}"
esac esac
else else
echo "$0: this script must be run as root... fatal error" echo "$0: this script must be run as root... fatal error"
fi fi