Archlinux Automatic Updates

arch

#1

I have an Arch server buried in the cloud quietly running a couple of small services, as such I really don’t check it very often.

Is there an easy way to automatically download and apply system updates on arch?


#2

You can always setup a cron job and run command:
pacman -Syu

I suggest you read the following page:

https://wiki.archlinux.org/index.php/User:Andy_Crowd/Update_packages_from_crontab


#3

The warning at the top of the page is very discouraging :confused:

Warning: Doing automatic updates from cron is strongly discouraged. It is likely to leave your machine in a broken and unbootable state. If this breaks your machine, do not hold anyone but yourself responsible. You have been warned.

Maybe I should just set a calendar reminder every month to update it.


#4

Arch is cutting edge Linux distro. It is going to be a problem no matter what you do. If I were you, I would make sure daily backups are enabled. Second, you can always check for output pacman command to see if you have any updates available. If so email it.

See if updates available on an Arch Linux box
pacman -Syup
OR
pacman -Qu

Maybe something as follows:

    #!/bin/bash
    pacman -Qu &>/dev/null
    if [ $? -eq 0 ]
    then
        echo "Updates needed"
    else
        echo "No updates needed"
    fi

Edit: Of course replace echo with mail command:

mail -s 'Update needed @ $(hostname)' your-email-id < /dev/null