Code Monkey home page Code Monkey logo

linux-automatic-updater's Introduction

Linux-Automatic-Updater

This is an automatic update script to update all your Debian and RHEL machines automatically. Alternative for unnatended-upgrades if you find this complicated to configure, specially for external repositories.

I have scripted all the steps within the Debian-auto-package-update.sh or RHEL-auto-package-update.sh based on your Distro, so you should only run this script and all below steps will be automatically configured. Enjoy!

Auto Package Update Script

The auto-package-update.sh script is a bash script that automates the process of updating packages on a Debian and RHEL based systems, ensuring that the system stays up to date with the latest security patches and bug fixes. Also patches any package in external repositories within /etc/apt/sources.list.d

Compatibility

The script has been tested and verified to work on the following systems:

  • Proxmox Virtual Environment (PVE): Proxmox VE is an open-source virtualization platform based on Debian. The script has been tested and verified to work on Proxmox VE systems.

  • Raspberry Pi with Debian Bullseye: The script has been tested and verified to work on Raspberry Pi devices running the Debian Bullseye operating system.

  • Debian Bookworm: The script has been tested and verified to work on systems running Debian Bookworm, the codename for Debian's testing distribution.

  • CentOS Stream 9: The script has been tested and verified to work on CentOS Stream 9, a rolling release distribution.

How It Works

  1. Update the Package List: The script starts by updating the package list using the apt update command. This fetches the latest information about available packages from the repositories.

  2. Upgrade Installed Packages: After updating the package list, the script proceeds to upgrade all installed packages without asking for confirmation. It achieves this using the apt -y full-upgrade command. This ensures that the system's software is updated to the latest versions available in the repositories.

  3. Remove Old Packages: The script also takes care of cleaning up the system by removing old, no longer needed packages. It does this using the apt -y autoremove command, which frees up disk space and keeps the system clean.

  4. Cron Job for Automation: To enable automated updates, the script sets up a cron job to run daily at 4:00 AM. It achieves this by adding a new entry to the system's crontab using the (crontab -l ; echo "0 4 * * * /usr/local/sbin/auto-package-update.sh") | crontab - command. The cron job ensures that the script runs at the specified time regularly, keeping the system up to date without manual intervention.

Important Note

  • Automatic package updates can be convenient, but they should be used with caution, especially in production environments. Before enabling automatic updates, ensure you have proper backups and understand the potential risks of automatic upgrades.

License

This script is released under the MIT License. Feel free to use, modify, and distribute it according to the terms of the license.

linux-automatic-updater's People

Contributors

kiraitachi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.