chatgpt improvement

This commit is contained in:
git 2025-08-10 18:28:53 +01:00
parent bf9d868ca4
commit ad792c363b

View File

@ -1,19 +1,21 @@
SHELL=/bin/bash
SHELL := /bin/bash
# The cron job you want to add
NEW_CRON="0 3 * * * $(shell pwd)/main.sh"
# Use Make's built-in current directory variable
CURDIR := $(abspath .)
NEW_CRON := 0 3 * * * $(CURDIR)/main.sh
.PHONY: run-script install requirements
run-script:
# run the main script
main.sh
# Run the main script
./main.sh
install:
# Add entry in crontab
# Check if it already exists (to avoid duplicates)
( crontab -l 2>/dev/null | grep -F "$(NEW_CRON)" ) && echo "Cron already exists." && exit 0
# Add the new cron safely
( crontab -l 2>/dev/null; echo "$(NEW_CRON)" ) | crontab -
# Add entry in crontab if missing (no duplicates)
@crontab -l 2>/dev/null | grep -Fqx '$(NEW_CRON)' && \
echo "Cron already exists." || \
{ (crontab -l 2>/dev/null; echo '$(NEW_CRON)') | crontab -; echo "Cron installed."; }
requirements:
# Add the necessary packages
apt-get -y install make miniupnpc gawk
apt-get -y install make miniupnpc gawk