Skip to content

Instantly share code, notes, and snippets.

@shawnsi
Last active March 11, 2022 06:54
Show Gist options
  • Save shawnsi/72fa1937a19bf984b7be248962789de3 to your computer and use it in GitHub Desktop.
Save shawnsi/72fa1937a19bf984b7be248962789de3 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)
@ysl2
Copy link

ysl2 commented Mar 11, 2022

Thanks!!! But how to apply updates, please? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment