Update resize_journal.sh

This commit is contained in:
spiritLHLS 2022-12-18 09:32:46 +08:00 committed by GitHub
parent f0c1fedafd
commit e77c5976f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,10 +88,10 @@ main() {
# Check if the line containing ForwardToSyslog is commented out # Check if the line containing ForwardToSyslog is commented out
if grep -q '^#\s*ForwardToSyslog=' /etc/systemd/journald.conf; then if grep -q '^#\s*ForwardToSyslog=' /etc/systemd/journald.conf; then
# If it is commented out, uncomment it and set the value to no # If it is commented out, uncomment it and set the value to no
sed -i "s/^#\s*ForwardToSyslog=.*/ForwardToSyslog=no/g" /etc/systemd/journald.conf sed -i "s/^#\s*ForwardToSyslog=no.*/ForwardToSyslog=no/g" /etc/systemd/journald.conf
else else
# If it is not commented out, just update the value # If it is not commented out, just update the value
sed -i "s/^ForwardToSyslog=.*/ForwardToSyslog=no/g" /etc/systemd/journald.conf sed -i "s/^ForwardToSyslog=no.*/ForwardToSyslog=no/g" /etc/systemd/journald.conf
fi fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to set ForwardToSyslog to no in journald.conf" echo "Failed to set ForwardToSyslog to no in journald.conf"