diff options
author | Malfurious <m@lfurio.us> | 2023-09-07 00:28:38 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2023-09-08 19:07:29 -0400 |
commit | 95531708431448d1f2ae2d7573421c2980a16a17 (patch) | |
tree | 6ca5414f83524ae703aa1ea6a391ca63c3923705 /acid/cychedelic | |
parent | 7a7ff89ff16542d30ff7c1f70689236b8fd9c607 (diff) | |
download | cychedelic-95531708431448d1f2ae2d7573421c2980a16a17.tar.gz cychedelic-95531708431448d1f2ae2d7573421c2980a16a17.zip |
acid: Remove running services no longer present in $CYCHE_SERVICES
If a service was previously managed by cychedelic, but an update to the
cyche code removes it from the config file, stop the service and delete
the git clone. As usual, this should leave any docker volumes intact.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to '')
-rwxr-xr-x | acid/cychedelic | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/acid/cychedelic b/acid/cychedelic index 17f2d33..a73554a 100755 --- a/acid/cychedelic +++ b/acid/cychedelic @@ -37,11 +37,23 @@ update() { done } +remove() { + next=$(printf '%s\n' "${CYCHE_SERVICES[@]}" | awk '{print $1}') + prev=$(ls -A '/services') + removed=$(printf '%s\n' "$next" "$next" "$prev" | sort | uniq -u) + + for name in $removed; do + cyche-remove "$name" + sleep "$CYCHE_JOB_TIME" + done +} + # startup: A restart of the ACID daemon usually indicates an elapse of the # $CYCHE_MAINT_TIME period, so rebuild services and perform cleanup now. We # sleep briefly at the beginning to allow the previous cychedelic instance time # to die. sleep "$CYCHE_STARTUP_TIME" +remove update --force docker system prune --force --all starttime=$(now) |