@mischievoustomato @anemone @Ghislaine my most complex tool to do systemd like things:
initctl
#!/bin/sh ################################################################################ #### A wrapper around update-rc.d(8) and service(8) #### #### to feel similar to systemctl and dispatch actions to multiple services #### ################################################################################ myname=${0##*/} # return type: string get_header_comment () { sed -n '/^#### /p' "$0" | sed 's/^#### /\t/ ; s/ ####$//' } run_dispatch () { for service in $service_list; do $1 "$service" "$action" done } show_usage () { printf '%s\n' "Usage:" printf '\t%s\n' "${myname} --help | [ ACTION ] <services>" } show_help () { printf '%s\n' "${myname}" get_header_comment show_usage printf ' %s' "ACTION" printf '\t%s\n' "where action is one of the following:" printf '\t\t %s\n' "start" printf '\t\t %s\n' "stop" printf '\t\t %s\n' "restart" printf '\t\t %s\n' "reload" printf '\t\t %s\n' "enable" printf '\t\t %s\n' "disable" printf '\t\t %s\n' "remove" printf '\t\t %s\n' "defaults" printf '\t\t %s\n' "defaults-disable" printf '\t\t%s%s\n' "for more information on the actions check" \ " 'man service' and 'man update-rc.d'" printf '\n' printf ' %s' "services" printf '\t%s\n' "is a space separated list of the services to perform the action on" printf '\n' printf ' %s' "--help" printf '\t%s\n' "show this message, the shortcuts '-h' and 'help' are also supported." } service_list="" # while the number of arguments is greater than 0 while [ "$#" -gt 0 ]; do case "$1" in enable|disable|defaults|remove|defaults-disable) dispatcher=update-rc.d action="$1" ;; start|stop|restart|reload|status) dispatcher=service action="$1" ;; -h|--help|help) show_help exit 0 ;; *) if [ -e "/etc/init.d/${1}" ]; then service_list="$service_list $1" else printf '[%s]: %s\n' "$myname" "service '$1' not present in /etc/init.d/" fi ;; esac shift done if [ -z "$action" ]; then printf '[%s]: %s\n' "${myname}" "no action was provided!" show_usage exit 1 fi if [ "$dispatcher" = "service" ]; then run_dispatch service else run_dispatch update-rc.d fi