Linux Server automatisch Updaten (mit apt, bash & cron)

Heute werden wir mit apt, Bash und Cron ein auto-update Script schreiben! 🙂

1. – Was brauchen wir?

Cron

apt-get install cron

apt

Das "Advanced Packaging Tool" ist automatisch bei jeder Debian Distribution dabei.

apt-get update && apt-get upgrade

bash

Standard Linux Shell.

bash

2. – Bash Script in /bin erstellen

nano /bin/cron-auto-update

Falls "nano" nicht installiert ist: apt-get install nano
apt-get update
apt-get upgrade -y

Script ausführbar machen:

chmod +x /bin/cron-auto-update

3. – In Cron einfügen

crontab -e
...
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
0 0 * * * cron-auto-update

 

Das war’s dann auch schon, viel Spaß mit eurem sich selbst aktualisierendem Server 😉

Das könnte Sie auch interessieren …

Schreiben Sie einen Kommentar

Ihre E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert