diff options
Diffstat (limited to 'tools/setup-unit')
-rwxr-xr-x | tools/setup-unit | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/setup-unit b/tools/setup-unit index c95d7b35..5baa5467 100755 --- a/tools/setup-unit +++ b/tools/setup-unit @@ -84,6 +84,7 @@ SYNOPSIS ├── os-probe [-h] ├── ps [-h] [-t TYPE] ├── repo-config [-hn] [PKG-MANAGER OS-NAME OS-VERSION] + ├── restart [-h] ├── sock [-h] SUBCOMMAND [ARGS] │ ├── filter [-chs] │ └── find [-h] @@ -1219,6 +1220,52 @@ __EOF__"; } +help_unit_restart() +{ + cat <<__EOF__ ; +SYNOPSIS + $0 restart [-h] + +DESCRIPTION + Restart all running unitd(8) instances. + +OPTIONS + -h, --help + Print this help. + +__EOF__ +} + + +unit_restart() +{ + while test $# -ge 1; do + case "$1" in + -h | --help) + help_unit_restart; + exit 0; + ;; + -*) + err "restart: $1: Unknown option."; + ;; + *) + err "restart: $1: Unknown argument."; + ;; + esac; + shift; + done; + + local cmds="$(unit_cmd)"; + + pkill -e unitd; + + printf '%s\n' "$cmds" \ + | while read -r cmd; do + eval $cmd; + done; +} + + help_unit_sock() { cat <<__EOF__ ; @@ -1478,6 +1525,10 @@ repo-config) shift; unit_repo_config $@; ;; +restart) + shift; + unit_restart $@; + ;; sock) shift; unit_sock $@; |