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