summaryrefslogtreecommitdiff
path: root/system/haveged/rc.haveged
diff options
context:
space:
mode:
authorErik Falor <ewfalor@gmail.com>2012-12-09 11:01:01 -0500
committerdsomero <xgizzmo@slackbuilds.org>2012-12-11 16:21:59 -0500
commit5d79d66d1c8d65e9a4e6bc4b7eccfaaa3a63655c (patch)
treeaa38d2e71a5a9125393a6ea186dfce1efc59fe2f /system/haveged/rc.haveged
parentba72f6af14a885c68540f12cefa957e45323037c (diff)
downloadslackbuilds-5d79d66d1c8d65e9a4e6bc4b7eccfaaa3a63655c.tar.gz
system/haveged: Added (A simple entropy daemon)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
Diffstat (limited to 'system/haveged/rc.haveged')
-rw-r--r--system/haveged/rc.haveged47
1 files changed, 47 insertions, 0 deletions
diff --git a/system/haveged/rc.haveged b/system/haveged/rc.haveged
new file mode 100644
index 0000000000..7f6f5e4fc2
--- /dev/null
+++ b/system/haveged/rc.haveged
@@ -0,0 +1,47 @@
+#!/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 /usr/sbin/haveged ]; then
+ echo "Starting HAVEGE daemon: /usr/sbin/haveged"
+ /usr/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