Added systemd service

This commit is contained in:
Eduard Urbach 2019-04-19 15:38:33 +09:00
parent 08186a9c92
commit f2a30422fa
2 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,7 @@ IP6TABLES=@sudo ip6tables
PACK:=$(shell command -v pack 2> /dev/null)
RUN:=$(shell command -v run 2> /dev/null)
GOIMPORTS:=$(shell command -v goimports 2> /dev/null)
SERVICEFILE=/etc/systemd/system/animenotifier.service
# Determine the name of the platform
OSNAME=
@ -52,6 +53,13 @@ run:
go install github.com/aerogo/run
goimports:
go install golang.org/x/tools/cmd/goimports
service:
sudo cp systemd.service $(SERVICEFILE)
sudo sed -i "s|MAKEFILE_USER|$(USER)|g" $(SERVICEFILE)
sudo sed -i "s|MAKEFILE_PWD|$(PWD)|g" $(SERVICEFILE)
sudo sed -i "s|MAKEFILE_EXEC|$(PWD)/notify.moe|g" $(SERVICEFILE)
sudo systemctl daemon-reload
@echo -e "\nYou can now start the service using:\n\nsudo systemctl start animenotifier"
tools:
ifeq ($(OSNAME),OSX)
brew install coreutils

13
systemd.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Anime Notifier
After=network.target
[Service]
Type=simple
User=MAKEFILE_USER
ExecStart=MAKEFILE_EXEC
WorkingDirectory=MAKEFILE_PWD
Restart=on-failure
[Install]
WantedBy=multi-user.target