Skip to content

Instantly share code, notes, and snippets.

@drautb
Last active August 29, 2015 14:16
Show Gist options
  • Save drautb/747cd16dcd5b2ef0619a to your computer and use it in GitHub Desktop.
Save drautb/747cd16dcd5b2ef0619a to your computer and use it in GitHub Desktop.
Runs recommended maintenance tasks on an Arch installation.
#!/usr/bin/env sh
# Runs the procedures recommended on this page:
# https://wiki.archlinux.org/index.php/System_maintenance
SYSTEMCTL=/usr/bin/systemctl
JOURNALCTL=/usr/bin/journalctl
PACMAN=/usr/bin/pacman
echo "\n*** FAILED SERVICES ***\n"
systemctl --failed
echo "\n*** CHECKING FOR ERRORS IN SYSTEMD JOURNAL ****\n"
journalctl -p 0..3 -xn
# If there were no errors, continue on.
# Update the Mirrorlist
# Remove orphaned packages. Command taken from:
# https://wiki.archlinux.org/index.php/Pacman_tips#Removing_orphaned_packages
echo "Removing orphaned packages..."
$PACMAN -Qtdq > /dev/null && sudo $PACMAN -Rns $($PACMAN -Qtdq | sed -e ':a;N;\$!ba;s/\n/ /g')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment