script and crontab

This commit is contained in:
caschick221 2024-05-06 14:23:37 -04:00
parent 9c53c7e946
commit 93d6364752
2 changed files with 30 additions and 0 deletions

1
crontab Normal file
View File

@ -0,0 +1 @@
@reboot /bin/sh /home/user/startup.sh

29
startup.sh Normal file
View File

@ -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"