feat: check if systemd is init

This commit is contained in:
Aliberk Sandıkçı 2023-07-29 13:21:35 +03:00
parent a0f16fff1b
commit 30d61c2969
Signed by: asandikci
GPG Key ID: 25C67A03B5666BC1
1 changed files with 4 additions and 1 deletions

View File

@ -15,7 +15,10 @@ go build -o ./bin/
# Installing # Installing
sudo mv ./bin/godaemon1 /usr/bin/godaemon1 sudo mv ./bin/godaemon1 /usr/bin/godaemon1
sudo mv ./godaemon1.service /etc/systemd/system/ if [ $(ps -jp 1 | awk 'FNR == 2 {print $6}') == "systemd" ]
then
sudo mv ./godaemon1.service /etc/systemd/system/
fi
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable godaemon1 sudo systemctl enable godaemon1
sudo systemctl start godaemon1 sudo systemctl start godaemon1