File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,7 @@ run_container_safe() {
370370
371371cleanup_lxc() {
372372 msg_info "Cleaning up"
373+
373374 if is_alpine; then
374375 $STD apk cache clean || true
375376 rm -rf /var/cache/apk/*
@@ -379,13 +380,15 @@ cleanup_lxc() {
379380 $STD apt -y clean || true
380381 fi
381382
382- rm -rf /tmp/* /var/tmp/*
383-
384- # Remove temp files created by mktemp/tempfile
383+ # Clear temp artifacts (keep sockets/FIFOs; ignore errors)
385384 find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true
386385 find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true
387386
388- find /var/log -type f -exec truncate -s 0 {} +
387+ # Truncate writable log files silently (permission errors ignored)
388+ if command -v truncate >/dev/null 2>&1; then
389+ find /var/log -type f -writable -print0 2>/dev/null | \
390+ xargs -0 -n1 truncate -s 0 2>/dev/null || true
391+ fi
389392
390393 # Python pip
391394 if command -v pip &>/dev/null; then pip cache purge || true; fi
@@ -407,8 +410,8 @@ cleanup_lxc() {
407410 if command -v composer &>/dev/null; then composer clear-cache || true; fi
408411
409412 if command -v journalctl &>/dev/null; then
410- $STD journalctl --rotate
411- $STD journalctl --vacuum-time=10m
413+ $STD journalctl --rotate || true
414+ $STD journalctl --vacuum-time=10m || true
412415 fi
413416 msg_ok "Cleaned"
414417}
You can’t perform that action at this time.
0 commit comments