GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Embed Notice

HTML Code

Corresponding Notice

  1. Embed this notice
    EdBoatConnoisseur (edboatconnoisseur@poa.st)'s status on Tuesday, 18-Mar-2025 04:15:06 JSTEdBoatConnoisseurEdBoatConnoisseur
    in reply to
    • Ghislaine :dancing_z:
    • anemone
    • Johnny Peligro

    @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
    In conversation2 months ago from poa.stpermalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.

Embed this notice