Resolve paths for me from service names

This commit is contained in:
tcely 2025-04-10 13:30:17 -04:00 committed by GitHub
parent 19f277e628
commit 09fea17791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,17 +1,23 @@
#!/usr/bin/env sh #!/usr/bin/env sh
dir='/run/service'
svc_path() (
cd "${dir}"
realpath -e -s "$@"
)
if [ 0 -eq $# ] if [ 0 -eq $# ]
then then
set -- \ set -- \
/run/service/tubesync*-worker \ $( cd "${dir}" && svc_path tubesync*-worker ) \
/run/service/gunicorn \ "$( svc_path gunicorn )" \
/run/service/nginx "$( svc_path nginx )"
fi fi
for service in "$@" for service in $( svc_path "$@" )
do do
printf 1>&2 -- 'Restarting %s... ' "${service}" printf -- 'Restarting %s...' "${service#${dir}/}"
/command/s6-svc -wr -r "${service}" /command/s6-svc -wr -r "${service}"
printf 1>&2 -- 'completed.\n' printf -- '\tcompleted.\n'
done done
unset -v service unset -v service