From 09fea177918cd37713d176b6da73e4078ba9532f Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 10 Apr 2025 13:30:17 -0400 Subject: [PATCH] Resolve paths for me from service names --- tubesync/restart_services.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index 140bc6d9..e3da89ef 100644 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -1,17 +1,23 @@ #!/usr/bin/env sh +dir='/run/service' +svc_path() ( + cd "${dir}" + realpath -e -s "$@" +) + if [ 0 -eq $# ] then set -- \ - /run/service/tubesync*-worker \ - /run/service/gunicorn \ - /run/service/nginx + $( cd "${dir}" && svc_path tubesync*-worker ) \ + "$( svc_path gunicorn )" \ + "$( svc_path nginx )" fi -for service in "$@" +for service in $( svc_path "$@" ) do - printf 1>&2 -- 'Restarting %s... ' "${service}" + printf -- 'Restarting %s...' "${service#${dir}/}" /command/s6-svc -wr -r "${service}" - printf 1>&2 -- 'completed.\n' + printf -- '\tcompleted.\n' done unset -v service