From 93d63647520a1c4535691c5e0434d0b43d78d65a Mon Sep 17 00:00:00 2001 From: caschick221 Date: Mon, 6 May 2024 14:23:37 -0400 Subject: [PATCH] script and crontab --- crontab | 1 + startup.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 crontab create mode 100644 startup.sh diff --git a/crontab b/crontab new file mode 100644 index 0000000..2d6136b --- /dev/null +++ b/crontab @@ -0,0 +1 @@ +@reboot /bin/sh /home/user/startup.sh diff --git a/startup.sh b/startup.sh new file mode 100644 index 0000000..0bf8c52 --- /dev/null +++ b/startup.sh @@ -0,0 +1,29 @@ +#!/bin/sh +sudo cp /home/user/CNSA/CNSA-276-FP/config.ini /config.bak +sudo rm -R /home/user/CNSA/CNSA-276-FP + + + +# Function to check internet connectivity +check_internet_connection() { + ping -c 1 1.1.1.1 > /dev/null 2>&1 + return $? +} + +# Wait for internet connection +while ! check_internet_connection; do + echo "Waiting for internet connection..." + sleep 1 # Wait for 1 seconds before checking again +done + +# Internet connection established +echo "Internet connection established. Running the portion of the script that requires it." + +# Add your code here that requires an internet connection + + +git clone https://gitea.eggtech.net/eggman20339/CNSA-276-FP.git /home/user/CNSA/CNSA-276-FP + +sudo cp /config.bak /home/user/CNSA/CNSA-276-FP/config.ini + +screen -dmS DoorAuth bash -c "cd /home/user/CNSA/CNSA-276-FP/ && python3 main.py" \ No newline at end of file