From 48dcf54d9f62fbac9f37a48388f0c558779c54c7 Mon Sep 17 00:00:00 2001 From: Kyle K Date: Thu, 18 Oct 2018 00:51:57 -0500 Subject: support cleaning systemd journal files in /run/log/journal --- clean-logs.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clean-logs.sh b/clean-logs.sh index 0ea4956..545fe1c 100755 --- a/clean-logs.sh +++ b/clean-logs.sh @@ -6,9 +6,12 @@ find /var/log/ -type f -name "*.1" -exec rm -f {} \; find /var/log/ -type f -name "*.old" -exec rm -f {} \; # clean systemd's journal -if [[ -d /var/log/journal ]]; then +if [[ -d /var/log/journal || -d /run/log/journal/ ]]; then systemctl stop systemd-journald - journal_dirs=$(find /var/log/journal/ -maxdepth 1 -type d -name "a*") + journal_dirs1=$(find /var/log/journal/ -maxdepth 1 -type d -name "a*") + journal_dirs2=$(find /run/log/journal/ -maxdepth 1 -type d -name "f*") + journal_dirs="$journal_dirs1 $journal_dirs2"; + for j in $journal_dirs; do echo "removing ${j}" rm -rf $j @@ -32,3 +35,4 @@ fi find /var/log/ -name "*.log" -exec truncate -s 0 {} \; exit 0 + -- cgit v1.2.3