From 411f266cebe537628ce7d3f92ccedff88afb4502 Mon Sep 17 00:00:00 2001 From: WickedYoda <68271168+wickedyoda@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:42:49 -0600 Subject: [PATCH] changes many changes --- cron-job-setup-files/cronjob-setup.sh | 5 ++- cron-job-setup-files/setup_cron_jobs.py | 0 cron-job-setup-files/setup_cronjob.py | 42 ------------------- ubuntu-debian-based/install_docker_debian.sh | 31 -------------- ubuntu-debian-based/setup_cron_job_updates.sh | 2 +- 5 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 cron-job-setup-files/setup_cron_jobs.py delete mode 100644 cron-job-setup-files/setup_cronjob.py delete mode 100644 ubuntu-debian-based/install_docker_debian.sh diff --git a/cron-job-setup-files/cronjob-setup.sh b/cron-job-setup-files/cronjob-setup.sh index b38b280..eced89e 100644 --- a/cron-job-setup-files/cronjob-setup.sh +++ b/cron-job-setup-files/cronjob-setup.sh @@ -9,5 +9,6 @@ sudo systemctl enable cron sudo systemctl start cron # Echo the command below into the file /etc/crontab -echo 'MAILTO="alert@tyates.one" -0 */6 * * * root /home/traver/public-setupfiles/updates_scripts/updates.sh' | sudo tee -a /etc/crontab +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 -a /etc/crontab +0 */1 * * * root mount -a #makes sure the nas is mounted \ No newline at end of file diff --git a/cron-job-setup-files/setup_cron_jobs.py b/cron-job-setup-files/setup_cron_jobs.py deleted file mode 100644 index e69de29..0000000 diff --git a/cron-job-setup-files/setup_cronjob.py b/cron-job-setup-files/setup_cronjob.py deleted file mode 100644 index 64a0e83..0000000 --- a/cron-job-setup-files/setup_cronjob.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python3 - -import subprocess - -#!/usr/bin/env python3 - -import subprocess - -# Check if Python 3 is installed -try: - subprocess.run(["python3", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) -except subprocess.CalledProcessError: - print("Python 3 is not installed. Installing Python 3...") - subprocess.run(["sudo", "apt", "update"]) - subprocess.run(["sudo", "apt", "install", "python3", "-y"]) - -# Rest of the script as before -# ... - -# Update package lists and install cron -subprocess.run(["sudo", "apt", "update"]) -subprocess.run(["sudo", "apt", "install", "cron", "-y"]) - -# Enable and start the cron service -subprocess.run(["sudo", "systemctl", "enable", "cron"]) -subprocess.run(["sudo", "systemctl", "start", "cron"]) - -# Stop the cron service to make changes -subprocess.run(["sudo", "systemctl", "stop", "cron"]) - -# Define the cron job command -cron_job_command = ( - 'MAILTO="alerts@tyates.one"\n' - '0 */6 * * * root /home/traver/public-setupfiles/updates_scripts/updates.sh' -) - -# Write the cron job to a file -with open("/etc/cron.d/auto_updates", "w") as cron_file: - cron_file.write(cron_job_command) - -# Restart the cron service to apply the new cron job -subprocess.run(["sudo", "systemctl", "start", "cron"]) diff --git a/ubuntu-debian-based/install_docker_debian.sh b/ubuntu-debian-based/install_docker_debian.sh deleted file mode 100644 index 52d1fa3..0000000 --- a/ubuntu-debian-based/install_docker_debian.sh +++ /dev/null @@ -1,31 +0,0 @@ -/#bash - -#Make sure Cache is updated -apt update - -# Bring system up to date (can be # out as not always required) -apt upgrade -y - -#install certs app -apt install ca-certificates curl gnupg -y - -#import keyrings -install -m 0755 -d /etc/apt/keyrings -curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg -chmod a+r /etc/apt/keyrings/docker.gpg - -#Add docker repo to apt sources -echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null - -#Pull cache sources including docker now. -apt update - -#install docker -apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y - -#Add current user to docker admin group, takes affect after logout and back in -usermod -aG docker $USER -newgrp docker \ No newline at end of file diff --git a/ubuntu-debian-based/setup_cron_job_updates.sh b/ubuntu-debian-based/setup_cron_job_updates.sh index f72b045..c130017 100644 --- a/ubuntu-debian-based/setup_cron_job_updates.sh +++ b/ubuntu-debian-based/setup_cron_job_updates.sh @@ -22,7 +22,7 @@ sudo systemctl stop cron # Added new line to test. 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 -a /etc/crontab - +0 */1 * * * root mount -a #makes sure the nas is mounted # Restart the cron service to apply the new cron job sudo systemctl start cron