aboutsummaryrefslogtreecommitdiff
path: root/system/bit-babbler/rc.seedd.new
diff options
context:
space:
mode:
Diffstat (limited to 'system/bit-babbler/rc.seedd.new')
-rw-r--r--system/bit-babbler/rc.seedd.new32
1 files changed, 14 insertions, 18 deletions
diff --git a/system/bit-babbler/rc.seedd.new b/system/bit-babbler/rc.seedd.new
index c7df6b2effc5c..6d0df20bc47fd 100644
--- a/system/bit-babbler/rc.seedd.new
+++ b/system/bit-babbler/rc.seedd.new
@@ -2,41 +2,37 @@
#
# /etc/rc.d/rc.seedd: start and stop BitBabbler TRNG(s).
-BBOPTS='--daemon --config=/etc/bit-babbler/seedd.conf'
+BBOPTS="--daemon --config=/etc/bit-babbler/seedd.conf"
+BBSOCKET=/run/bit-babbler/seedd.socket
seedd_start() {
- if [ -S /var/run/bit-babbler/seedd.socket ]; then
+ if [ -S $BBSOCKET ]; then
echo 'seedd appears to be already running!'
+ exit 1
else
- echo 'Checking for BitBabbler(s)...'
- /usr/bin/seedd --scan
+ echo 'Checking for BitBabbler...'
+ /usr/bin/seedd --scan
echo "Starting seedd: /usr/bin/seedd $BBOPTS"
- /usr/bin/seedd $BBOPTS
+ /usr/bin/seedd $BBOPTS
fi
}
seedd_stop() {
echo 'Stopping seedd...'
killall -w seedd
- rm -f /var/run/bit-babbler/seedd.socket.lock
+ # daemon doesn't clean unused socket lock.
+ rm -f $BBSOCKET.lock
}
seedd_restart() {
seedd_stop
- sleep 2
+ sleep 2 # ...take a breath...
seedd_start
}
case "$1" in
-'start')
- seedd_start
- ;;
-'stop')
- seedd_stop
- ;;
-'restart')
- seedd_restart
- ;;
-*)
- echo "usage $0 start|stop|restart"
+ 'start') seedd_start;;
+ 'restart') seedd_restart;;
+ 'stop') seedd_stop;;
+ *) echo "usage $0 start|restart|stop";;
esac