From dc8bbadc3262aa49e74ab2de16b80f05b264b909 Mon Sep 17 00:00:00 2001 From: WickedYoda <68271168+wickedyoda@users.noreply.github.com> Date: Tue, 22 Aug 2023 14:52:29 -0500 Subject: [PATCH] Updated setting up cronjob auto updates --- setup_cron_job_updates.sh | 21 +++++++++++++++---- .../dockercompose_install.sh | 0 .../ubuntu_install_apps.sh | 0 3 files changed, 17 insertions(+), 4 deletions(-) rename dockercompose_install.sh => ubuntu-debian-based/dockercompose_install.sh (100%) rename {ubuntu => ubuntu-debian-based}/ubuntu_install_apps.sh (100%) diff --git a/setup_cron_job_updates.sh b/setup_cron_job_updates.sh index 47c0ae9..b7e5ed6 100644 --- a/setup_cron_job_updates.sh +++ b/setup_cron_job_updates.sh @@ -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 \ No newline at end of file +# Restart the cron service to apply the new cron job +sudo systemctl start cron diff --git a/dockercompose_install.sh b/ubuntu-debian-based/dockercompose_install.sh similarity index 100% rename from dockercompose_install.sh rename to ubuntu-debian-based/dockercompose_install.sh diff --git a/ubuntu/ubuntu_install_apps.sh b/ubuntu-debian-based/ubuntu_install_apps.sh similarity index 100% rename from ubuntu/ubuntu_install_apps.sh rename to ubuntu-debian-based/ubuntu_install_apps.sh