pievr/Makefile

25 lines
579 B
Makefile

.PHONY: all build start stop restart clean
all: build
build:
@mkdir -p junk
go build -o junk/pievr ./cmd/pievr
stop:
@if [ -f junk/pievr.pid ]; then \
echo "Stopping bot (PID $$(cat junk/pievr.pid))..."; \
kill -15 $$(cat junk/pievr.pid) 2>/dev/null || true; \
rm -f junk/pievr.pid; \
fi
@pkill -9 -f "./junk/pievr" 2>/dev/null || true
start: stop build
@echo "Starting bot..."
@nohup ./junk/pievr > junk/bot.log 2>&1 & echo $$! > junk/pievr.pid
@echo "Bot started with PID $$(cat junk/pievr.pid). Logs: junk/bot.log"
restart: start
clean: stop
@rm -rf junk