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