#!/bin/sh # timer-control enable|disable NAME: enables and starts, or disables and stops, # one systemd timer, if /etc/archie/timers lists it. Run by the host connector # through sudo, so it trusts none of its arguments. set -eu [ "$#" -eq 2 ] || { echo "usage: timer-control enable|disable NAME" >&2; exit 2; } case "$1" in enable | disable) ;; *) echo "verb must be enable or disable" >&2; exit 2 ;; esac case "$2" in *.timer) ;; *) echo "name must end in .timer" >&2; exit 2 ;; esac grep -qxF -- "$2" /etc/archie/timers || { echo "$2 is not listed in /etc/archie/timers" >&2; exit 3; } exec systemctl "$1" --now -- "$2"