From 30d61c2969e9ae5890336c0af4214580d992a37d Mon Sep 17 00:00:00 2001 From: asandikci Date: Sat, 29 Jul 2023 13:21:35 +0300 Subject: [PATCH] feat: check if systemd is init --- go-daemon/install.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go-daemon/install.sh b/go-daemon/install.sh index 58d9429..b038148 100644 --- a/go-daemon/install.sh +++ b/go-daemon/install.sh @@ -15,7 +15,10 @@ go build -o ./bin/ # Installing 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 enable godaemon1 sudo systemctl start godaemon1