https://github.com/mosowaz/automated-update-script-
Automating script with systemd timer
https://github.com/mosowaz/automated-update-script-
linux-package-manager systemd systemd-service systemd-timer
Last synced: 5 months ago
JSON representation
Automating script with systemd timer
- Host: GitHub
- URL: https://github.com/mosowaz/automated-update-script-
- Owner: mosowaz
- Created: 2023-11-11T03:36:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-24T17:03:38.000Z (about 2 years ago)
- Last Synced: 2024-11-20T13:58:02.317Z (about 1 year ago)
- Topics: linux-package-manager, systemd, systemd-service, systemd-timer
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Description
This script will update most linux distribution packages (i.e SLES, Opensuse, Debian, Ubuntu (and variants), Red Hat Enterprise Linux (and variants) ).
You will need to create the file as root (as sudo is required to run updates).
You can use either cron or systemd timer to automate the script.
In this repo, I'm using systemd timer.
## script
Put the update script (multi-distro-update_script.sh) in your "~/bin" directory.
Run `chmod +rx multi-distro-update_script.sh` to make it executable.
## Automation of script
- Create these two unit files ("auto-update.service" and "auto-update.timer") under `/etc/systemd/system`.
- To create them as root owner, change directory to `/etc/systemd/system`
```
/etc/systemd/system$ sudo touch auto-update.service auto-update.timer
```
- Then copy and paste the commands from the repo files for created files
- Run these commands;
```
/etc/systemd/system$ sudo systemctl daemon-reload
/etc/systemd/system$ sudo systemctl enable auto-update.service
/etc/systemd/system$ sudo systemctl enable auto-update.timer
/etc/systemd/system$ sudo systemctl start auto-update.service
```
check the status of their statuses with
```
/etc/systemd/system$ systemctl status -l auto-update.service
/etc/systemd/system$ systemctl status -l auto-update.timer
```