Rewrite to match the irix script.
This commit is contained in:
parent
1bfba17d08
commit
388c3f33a6
@ -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
|
||||
echo "Starting $DESC"
|
||||
/usr/local/sbin/prngd /var/run/egd-pool
|
||||
else
|
||||
echo "A running $DESC was found, please stop this first"
|
||||
fi
|
||||
;;
|
||||
'stop' ) if [ -n "$PID" ]; then
|
||||
echo "Stopping $DESC"
|
||||
kill -TERM $PID
|
||||
else
|
||||
echo "$DESC already stopped"
|
||||
fi
|
||||
;;
|
||||
'restart') $0 stop
|
||||
$0 start
|
||||
;;
|
||||
*) echo "Usage: $0 {start|stop|restart}"
|
||||
'start' )
|
||||
if test -x $PRNGD_BIN; then
|
||||
echo "Starting $DESC"
|
||||
check_pooldir
|
||||
$PRNGD_BIN $POOLDIR/$POOLFILE
|
||||
fi
|
||||
;;
|
||||
'stop' )
|
||||
echo "Stopping $DESC"
|
||||
$PRNGD_BIN -k $POOLDIR/$POOLFILE >/dev/null 2>&1
|
||||
;;
|
||||
'restart')
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
esac
|
||||
|
||||
else
|
||||
echo "$0: this script must be run as root... fatal error"
|
||||
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user