21 lines
548 B
Makefile
21 lines
548 B
Makefile
SHELL := /bin/bash
|
|
|
|
# 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
|
|
bash ./main.sh
|
|
|
|
install:
|
|
# 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
|