mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-04 20:29:09 +01:00
39dab91813
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
47 lines
767 B
Bash
47 lines
767 B
Bash
#!/bin/sh
|
|
# Start/stop/restart haveged.
|
|
|
|
PIDFILE=/var/run/haveged.pid
|
|
HAVEGED_OPTS="-w 1024 -v 1 -p $PIDFILE"
|
|
|
|
# Start haveged:
|
|
haveged_start() {
|
|
if [ -f $PIDFILE ]; then
|
|
echo "HAVEGE daemon is already running as PID $(cat $PIDFILE) " >&2
|
|
exit 3
|
|
elif [ -x /sbin/haveged ]; then
|
|
echo "Starting HAVEGE daemon: /sbin/haveged"
|
|
/sbin/haveged $HAVEGED_OPTS
|
|
fi
|
|
}
|
|
|
|
# Stop haveged:
|
|
haveged_stop() {
|
|
if [ -r /var/run/haveged.pid ]; then
|
|
kill $(cat /var/run/haveged.pid)
|
|
else
|
|
killall haveged
|
|
fi
|
|
}
|
|
|
|
# Restart haveged:
|
|
haveged_restart() {
|
|
haveged_stop
|
|
sleep 1
|
|
haveged_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
haveged_start
|
|
;;
|
|
'stop')
|
|
haveged_stop
|
|
;;
|
|
'restart')
|
|
haveged_restart
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart"
|
|
exit 2
|
|
esac
|