aboutsummaryrefslogtreecommitdiff
path: root/efi-sync/files/rc.efi-sync.new
diff options
context:
space:
mode:
Diffstat (limited to 'efi-sync/files/rc.efi-sync.new')
-rw-r--r--efi-sync/files/rc.efi-sync.new60
1 files changed, 60 insertions, 0 deletions
diff --git a/efi-sync/files/rc.efi-sync.new b/efi-sync/files/rc.efi-sync.new
new file mode 100644
index 0000000..727c93b
--- /dev/null
+++ b/efi-sync/files/rc.efi-sync.new
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Startup/shutdown script for GNU Taler's exchange.
+#
+
+# Seconds to wait for daemon to shutdown.
+SHUTDOWN_WAIT=60
+
+mkdir -p /run/efi-sync
+
+start() {
+ echo "Starting EFI Sync"
+
+ daemon \
+ --name=efi-sync \
+ --pidfiles=/run/efi-sync \
+ --output=/var/log/efi-sync.log \
+ -- efi-sync watch
+}
+
+stop() {
+ echo "Stopping EFI Sync"
+
+ if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running ; then
+ /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --stop
+ fi
+
+ # Wait for daemon to politely shutdown.
+ sleep 1
+ if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running; then
+ echo "Waiting up to ${SHUTDOWN_WAIT} to stop..."
+
+ let "count = 0"
+ while /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running && [[ $count -lt 60 ]]; do
+ sleep 1
+ let "count = $count + 1"
+ done
+ fi
+}
+
+status() {
+ if /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running ; then
+ /usr/bin/daemon --pidfiles=/run/efi-sync --name=efi-sync --running --verbose
+ fi
+}
+
+case "$1" in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+status)
+ status
+ ;;
+*)
+ echo $"Usage: $0 {start|stop|status}"
+ exit 1
+esac