Skip to content

Instantly share code, notes, and snippets.

@ysl2
Forked from shawnsi/README.md
Created March 11, 2022 06:54
Show Gist options
  • Save ysl2/a2d2bb647f5827127473aaae886a0942 to your computer and use it in GitHub Desktop.
Save ysl2/a2d2bb647f5827127473aaae886a0942 to your computer and use it in GitHub Desktop.
Pacman Automatic Updates

Background

I may have let Arch go months without updates before. Its not advisable to apply them on a schedule either.

Solution

Providing regular prompts to apply updates seems like the best solution.

Schedule Download of Packages

This cronjob will download packages and cache locally. Put into root's crontab or run via sudo.

0 2 * * * /usr/bin/pacman -Syuwq

Prompt for Upgrade

Drop this line into .bashrc and you will be prompted to apply updates once per day.

# Prompt to update arch linux once each day
[ -f ~/.update/$(date +%F) ] || (mkdir -p ~/.update; rm -f ~/.update/*; touch ~/.update/$(date +%F); sudo pacman -Syuq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment