From a0ef06810c31a0227b9946a7d3319c5869fb89e4 Mon Sep 17 00:00:00 2001 From: fbt Date: Tue, 11 Feb 2020 03:00:24 +0300 Subject: [PATCH] shaky, abort Signed-off-by: fbt --- ssm | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/ssm b/ssm index 1a9d15e..def6125 100755 --- a/ssm +++ b/ssm @@ -5,26 +5,6 @@ shopt -s nullglob is_function() [[ "$(type -t "$1" 2>/dev/null)" == 'function' ]] readonly -f is_function -command_not_found_handle() { - declare f=$1; shift; declare argv=( "$@" ) - - # Skip the special name 'source'. - # Don't call your functions 'source'. - declare i - for i in "${FUNCNAME[@]:1}"; do - [[ $i == 'source' ]] && continue - f="${i}${f}" - break - done - - is_function "$f" || { - printf '%s: line %s: %s: command not found\n' "$0" "${BASH_LINENO[0]}" "$f" >&2 - return 127 - } - - "$f" "${argv[@]}" -}; readonly command_not_found_handle; - usage() { cat <<- EOF Usage: ssm @@ -506,11 +486,11 @@ info() { declare _status_code _status _show_pid var _info_items _status_code _status _show_pid - .item Name "$service_name" + info.item Name "$service_name" status; _status_code = "$?" if service_oneshot; then - .item Oneshot 'yes' + infoinfo.item Oneshot 'yes' case $_status_code in (0) _status = 'success';; @@ -519,7 +499,7 @@ info() { (*) _status = 'unknown';; esac else - .item Restart "$service_respawn" + info.item Restart "$service_respawn" case $_status_code in (0) _status = 'running';; @@ -531,23 +511,23 @@ info() { esac fi - .item Status "$_status" + info.item Status "$_status" - .item Exec "${service_command[*]}" - .item Config "$service_config" - .item Workdir "$service_workdir" + info.item Exec "${service_command[*]}" + info.item Config "$service_config" + info.item Workdir "$service_workdir" - .item 'Output log' "$service_logfile_out" + info.item 'Output log' "$service_logfile_out" service_logfile_out == "$service_logfile_err" || \ - .item 'Error log' "$service_logfile_err" + info.item 'Error log' "$service_logfile_err" if service_running; then - .item PID "$service_pid" - .item PIDFile "$service_pidfile" + info.item PID "$service_pid" + info.item PIDFile "$service_pidfile" cgroups && { - .item Cgroup "$cgroup_home/$service_cgroup_name" - .item 'Cgroup procs' "${#service_cgroup_procs[@]}" + info.item Cgroup "$cgroup_home/$service_cgroup_name" + info.item 'Cgroup procs' "${#service_cgroup_procs[@]}" } fi