From 7efe4e4c9dbf2fd07b5390c71e7b4f26efe50c5f Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 31 Jan 2026 22:17:35 -0500 Subject: [PATCH 1/5] Update restart_services.sh --- tubesync/restart_services.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index 3c1d981bb..10543d5ae 100755 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -6,13 +6,7 @@ svc_path() ( realpath -e -s "$@" ) -_bundles="$( - find '/etc/s6-overlay/s6-rc.d' -mindepth 2 -maxdepth 2 \ - -name 'type' \ - -execdir grep -F -q -e bundle '{}' ';' \ - -printf '%P\n' | \ - sed -e 's,/type$,,' ; -)" +_bundles="$(/command/s6-rc-db list bundles)" is_a_bundle() { local bundle for bundle in ${_bundles} @@ -25,9 +19,29 @@ is_a_bundle() { return 1 } +_services="$(/command/s6-rc-db atomics user user2)" +is_a_longrun() { + if [ 'longrun' = "$(/command/s6-rc-db type "$1")" ] + then + return 0 + fi + return 1 +} +only_longruns() { + local service + for service in "$@" + do + if is_a_longrun "${service}" + then + printf -- '%s\n' "${service}" + fi + done +} +_longruns="$(only_longruns ${_services})" + if [ 0 -eq $# ] then - set -- $(/command/s6-rc list user | grep -v -e '-init$') + set -- $(only_longruns $(/command/s6-rc -a list)) fi for arg in "$@" @@ -35,7 +49,7 @@ do _svcs="${arg}" if is_a_bundle "${arg}" then - _svcs="$(/command/s6-rc list "${arg}" | grep -v -e '-init$')" + _svcs="$(only_longruns $(/command/s6-rc list "${arg}"))" fi for service in $(svc_path ${_svcs}) do @@ -48,4 +62,4 @@ do done done unset -v _began _ended _svcs arg service -unset -v _bundles _dir +unset -v _bundles _dir _longruns _services From 61fb55e229208149431b62eb7aae25841e75b8c9 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 31 Jan 2026 22:39:27 -0500 Subject: [PATCH 2/5] Do not print essential services --- tubesync/restart_services.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index 10543d5ae..062a55416 100755 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -41,7 +41,7 @@ _longruns="$(only_longruns ${_services})" if [ 0 -eq $# ] then - set -- $(only_longruns $(/command/s6-rc -a list)) + set -- $(only_longruns $(/command/s6-rc -e -a list)) fi for arg in "$@" @@ -49,7 +49,7 @@ do _svcs="${arg}" if is_a_bundle "${arg}" then - _svcs="$(only_longruns $(/command/s6-rc list "${arg}"))" + _svcs="$(only_longruns $(/command/s6-rc -e list "${arg}"))" fi for service in $(svc_path ${_svcs}) do From 2693952a56e43224fa086d4dd7f7bfdf4abc8115 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 31 Jan 2026 22:55:04 -0500 Subject: [PATCH 3/5] Using list collapses the cases --- tubesync/restart_services.sh | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index 062a55416..b59deac90 100755 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -6,19 +6,6 @@ svc_path() ( realpath -e -s "$@" ) -_bundles="$(/command/s6-rc-db list bundles)" -is_a_bundle() { - local bundle - for bundle in ${_bundles} - do - if [ "$1" = "${bundle}" ] - then - return 0 - fi - done - return 1 -} - _services="$(/command/s6-rc-db atomics user user2)" is_a_longrun() { if [ 'longrun' = "$(/command/s6-rc-db type "$1")" ] @@ -41,17 +28,13 @@ _longruns="$(only_longruns ${_services})" if [ 0 -eq $# ] then - set -- $(only_longruns $(/command/s6-rc -e -a list)) + set -- $(/command/s6-rc -e -a list) fi for arg in "$@" do - _svcs="${arg}" - if is_a_bundle "${arg}" - then - _svcs="$(only_longruns $(/command/s6-rc -e list "${arg}"))" - fi - for service in $(svc_path ${_svcs}) + _svcs="$(/command/s6-rc -e list "${arg}")" + for service in $(svc_path $(only_longruns ${_svcs})) do printf -- 'Restarting %-28s' "${service#${_dir}/}..." _began="$( date '+%s' )" @@ -62,4 +45,4 @@ do done done unset -v _began _ended _svcs arg service -unset -v _bundles _dir _longruns _services +unset -v _dir _longruns _services From b73267bb94440fabbe36948dc4cf57f38997a8b9 Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 31 Jan 2026 23:07:53 -0500 Subject: [PATCH 4/5] Remove unnecessary variables --- tubesync/restart_services.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index b59deac90..87a2171d5 100755 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -6,7 +6,6 @@ svc_path() ( realpath -e -s "$@" ) -_services="$(/command/s6-rc-db atomics user user2)" is_a_longrun() { if [ 'longrun' = "$(/command/s6-rc-db type "$1")" ] then @@ -24,7 +23,6 @@ only_longruns() { fi done } -_longruns="$(only_longruns ${_services})" if [ 0 -eq $# ] then @@ -33,8 +31,8 @@ fi for arg in "$@" do - _svcs="$(/command/s6-rc -e list "${arg}")" - for service in $(svc_path $(only_longruns ${_svcs})) + _svcs="$(only_longruns $(/command/s6-rc -e list "${arg}"))" + for service in $(svc_path ${_svcs}) do printf -- 'Restarting %-28s' "${service#${_dir}/}..." _began="$( date '+%s' )" @@ -44,5 +42,4 @@ do "$( expr "${_ended}" - "${_began}" )" done done -unset -v _began _ended _svcs arg service -unset -v _dir _longruns _services +unset -v _began _dir _ended _svcs arg service From 608a9f27aee0d8ffb767db84ad58fe273202c18c Mon Sep 17 00:00:00 2001 From: tcely Date: Sat, 31 Jan 2026 23:26:02 -0500 Subject: [PATCH 5/5] We still need to filter the default list --- tubesync/restart_services.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tubesync/restart_services.sh b/tubesync/restart_services.sh index 87a2171d5..c8e934808 100755 --- a/tubesync/restart_services.sh +++ b/tubesync/restart_services.sh @@ -26,7 +26,7 @@ only_longruns() { if [ 0 -eq $# ] then - set -- $(/command/s6-rc -e -a list) + set -- $(only_longruns $(/command/s6-rc -e -a list)) fi for arg in "$@"