mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
Updated setting up cronjob auto updates
This commit is contained in:
1 parent
6249f2b8d6
commit
dc8bbadc32
3 files changed
+17
-4
No files matched your search
@@ -1,9 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script: setup_auto_updates.sh
|
||||
# Description: Script to set up automatic system updates using cron
|
||||
|
||||
# Update package lists and install cron
|
||||
sudo apt update
|
||||
sudo apt install cron cron-apt -y
|
||||
sudo apt install cron -y
|
||||
|
||||
# Enable and start the cron service
|
||||
sudo systemctl enable cron
|
||||
sudo systemctl start cron
|
||||
|
||||
# Stop the cron service to make changes
|
||||
sudo systemctl stop cron
|
||||
|
||||
echo "MAILTO="alerts@tyates.one"
|
||||
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y" >> /etc/crontab
|
||||
# Add the update and upgrade cron job to /etc/cron.d/
|
||||
echo 'MAILTO="alerts@tyates.one"
|
||||
0 */6 * * * root apt-get update && apt-get -y -d full-upgrade && apt-get autoremove -y && sudo apt-get clean -y && sudo apt-get purge -y' | sudo tee /etc/cron.d/auto_updates
|
||||
|
||||
sudo systemctl start cron
|
||||
# Restart the cron service to apply the new cron job
|
||||
sudo systemctl start cron
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user