#!/bin/bash ## Script Location SCRIPTDIR=$(dirname $0) source "$SCRIPTDIR/common/colors.sh" source "$SCRIPTDIR/common/functions.sh" source "$SCRIPTDIR/common/load-defaults.sh" do_limit_journal() { systemd_journald_conf="/etc/systemd/journald.conf" if [[ $(grep -L "Change Logging maximums" $systemd_journald_conf) ]]; then printf "$COL_YELLOW" "** Applying Systemd Journal tweak" cat <> $systemd_journald_conf #Change Logging maximums RuntimeMaxFileSize=50 RuntimeMaxFiles=100 EOT else printf "$COL_YELLOW" "** Systemd Journal tweak already applied" fi } printf "$COL_LIGHT_BLUE" "* Checking for Systemd Journal directory" journal_directory="/var/log/journal" if [ ! -d "$journal_directory" ]; then printf "$COL_YELLOW" "** creating Systemd Journal installation directory" mkdir $journal_directory fi if [ "$systemd_journaling_tweak" == "ask" ]; then if (whiptail --title "Systemd Journalling limits" --yes-button "yes" --no-button "no" --yesno "Do You want to limit systemd journalling?" 10 80) then systemd_journaling_tweak=1 else systemd_journaling_tweak=0 fi fi if [ "$systemd_journaling_tweak" == 1 ]; then printf "$COL_YELLOW" "** Limitting" do_limit_journal systemctl restart systemd-journald else printf "$COL_YELLOW" "** not Applying Systemd Journal tweak" fi