Added support for Go installed services

This commit is contained in:
Eduard Urbach 2019-09-06 13:43:53 +09:00
parent 985423e981
commit 712b9cdce1
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
3 changed files with 30 additions and 2 deletions

View File

@ -1,14 +1,16 @@
#!/bin/sh
INSTALLPATH="/etc/systemd/system/"
GOBIN="$(go env GOPATH)/bin"
cd $(dirname $0)
for service in *; do
for service in *.service; do
[ -f "$service" ] &&
echo "Installing services/$service" &&
sudo cp "services/$service" "$INSTALLPATH/$service" &&
sudo sed -i "s|MAKEFILE_USER|$USER|g" "$INSTALLPATH/$service" &&
sudo sed -i "s|MAKEFILE_GOBIN|$GOBIN|g" "$INSTALLPATH/$service" &&
sudo sed -i "s|MAKEFILE_PWD|$PWD|g" "$INSTALLPATH/$service"
done
sudo systemctl daemon-reload
sudo systemctl daemon-reload &&
echo -e "\nYou can now start the service using:\n\nsudo systemctl start animenotifier.service"

View File

@ -0,0 +1,13 @@
[Unit]
Description=Image Server
After=animenotifier.service
[Service]
Type=simple
User=MAKEFILE_USER
ExecStart=MAKEFILE_GOBIN/imageserver
WorkingDirectory=MAKEFILE_PWD
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=Image Server
After=animenotifier.service
[Service]
Type=simple
User=MAKEFILE_USER
ExecStart=MAKEFILE_GOBIN/japanese
WorkingDirectory=MAKEFILE_PWD
Restart=on-failure
[Install]
WantedBy=multi-user.target