From 6bd1b9aca736aa6f12a1e27270bc29ceb116a2e1 Mon Sep 17 00:00:00 2001 From: ScottishDex <35346954+ScotDex@users.noreply.github.com> Date: Tue, 8 Jul 2025 22:48:36 +0100 Subject: [PATCH] Rename script with correct spelling --- auto-system-maintenance.sh | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 auto-system-maintenance.sh diff --git a/auto-system-maintenance.sh b/auto-system-maintenance.sh new file mode 100644 index 0000000..6e955f5 --- /dev/null +++ b/auto-system-maintenance.sh @@ -0,0 +1,58 @@ +#!/bin/bash -x + +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this script. If not, see . + +# This script performs various system maintenance tasks to clean up logs, remove unnecessary packages, and update the system. +# It is based on the Ubuntu distribution and is intended for command line use. + +# Check disk usage of journal logs +journalctl --disk-usage + +# Rotate journal logs +sudo journalctl --rotate + +# Retain logs from the past 2 days only +sudo journalctl --vacuum-time=2days + +# Limit the space the log takes up to 100MB +sudo journalctl --vacuum-size=100M + +# Reload the systemd daemon +sudo systemctl daemon-reload + +# Display disk usage in human-readable format +df -h + +# Remove packages that are no longer needed +sudo apt-get autoremove + +# Clean the apt-get cache +sudo apt-get clean + +# Purge old kernels that are no longer in use +sudo apt-get autoremove --purge + +# Delete all .deb files from /var/cache/apt/archives +sudo apt-get autoclean + +# Update the package list +sudo apt-get update + +# Upgrade all packages to the latest versions +sudo apt-get upgrade + +# Note: You can use 'sudo apt-mark hold ' to prevent a specific package from being upgraded. + +# Reboot the system to apply all changes +sudo reboot \ No newline at end of file