#!/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