chatgpt improvement
This commit is contained in:
parent
bf9d868ca4
commit
ad792c363b
22
Makefile
22
Makefile
@ -1,18 +1,20 @@
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user