Automated Package Downloads, Installation and Cleaning Operating System: Fedora Linux
Bash Script
#!/bin/bash
# Update package list
dnf check-update
# List outdated packages (optionally)
outdated_packages=$(dnf repoquery --installed --latest-limit=1)
if [ -n "$outdated_packages" ]; then
# Remove outdated packages
dnf remove $(dnf repoquery --installed --latest-limit=1)
else
echo "No outdated packages found."
fi
Systemd Service
[Unit]
Description=Cleanup outdated packages
[Service]
Type=simple
User=root
Group=root
ExecStart= /home/**user/Programs/automated_upgrades.sh
Systemd Timer
[Unit]
Description=Run automatic_updates.sh every day
[Timer]
OnBootSec=10min
OnUnitActiveSec=30d
Unit=automated_updates.service
[Install]
WantedBy=timers.target