summaryrefslogtreecommitdiff
path: root/system/bit-babbler/rc.seedd
blob: de304c37b6ae95d35623a6b109da2dde0937dcc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
# /etc/rc.d/rc.seedd: start and stop BitBabbler TRNG(s).
#
# Revised 2 October 2015, AWG

seedd_start() {
  if [ -S /var/run/bit-babbler/seedd.socket ]; then
    echo 'seedd appears to be already running!'
  else
    echo 'Checking for BitBabbler(s)...'
    /usr/bin/seedd --scan 
    echo 'Starting seedd:  /usr/bin/seedd --daemon --kernel'
    /usr/bin/seedd --daemon --kernel
  fi
}

seedd_stop() {
  echo 'Stopping seedd...'
  killall -w seedd
  rm -f /var/run/bit-babbler/seedd.socket.lock
}

seedd_restart() {
  seedd_stop
  sleep 2
  seedd_start
}

case "$1" in
'start')
  seedd_start
  ;;
'stop')
  seedd_stop
  ;;
'restart')
  seedd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac