From 1d1d6286fec71b88d9cbc56ff3c53a7e31179fc5 Mon Sep 17 00:00:00 2001
From: wileyj <2847772+wileyj@users.noreply.github.com>
Date: Mon, 14 Mar 2022 14:49:05 -0700
Subject: [PATCH] Update for PR comments
- shellcheck adjustments for sysv init script
- launchd/systemd disabled respawn
- updated docs to reflect changes
---
contrib/init/org.stacks.stacks-blockchain.plist | 15 ++++++++-------
contrib/init/stacks.init | 11 +++++------
contrib/init/stacks.service | 2 +-
docs/init.md | 6 ++++--
4 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/contrib/init/org.stacks.stacks-blockchain.plist b/contrib/init/org.stacks.stacks-blockchain.plist
index 228ef1789..965b4fa30 100644
--- a/contrib/init/org.stacks.stacks-blockchain.plist
+++ b/contrib/init/org.stacks.stacks-blockchain.plist
@@ -11,12 +11,6 @@
--config=/etc/stacks-blockchain/Config.toml
- Nice
- 1
-
- StartInterval
- 60
-
ProcessType
Standard
@@ -27,6 +21,13 @@
/tmp/stacks-blockchain.log
RunAtLoad
-
+
+
+ ExitTimeOut
+ 60
+
+ KeepAlive
+
+
\ No newline at end of file
diff --git a/contrib/init/stacks.init b/contrib/init/stacks.init
index 1386b7ecb..1f10ed03e 100644
--- a/contrib/init/stacks.init
+++ b/contrib/init/stacks.init
@@ -55,15 +55,14 @@ stacks_log=${STACKS_BLOCKCHAIN_LOG-/stacks-blockchain/output.log}
start() {
- if [ ! -f $stacks_config ];then
+ if [ ! -f "$stacks_config" ];then
echo -n "Missing config file: $stacks_config "
return 1
fi
- [ -x $exec ] || exit 5
echo -n $"Starting $prog: "
- $stacks_bin start --config=$stacks_config > $stacks_log 2>&1 &
+ $stacks_bin start --config="$stacks_config" > "$stacks_log" 2>&1 &
RETVAL=$?
- [ $RETVAL -eq 0 ] && touch $lockfile
+ [ $RETVAL -eq 0 ] && touch "$lockfile"
echo
return $RETVAL
}
@@ -73,7 +72,7 @@ stop() {
killproc $prog -INT
RETVAL=$?
echo
- [ $RETVAL -eq 0 ] && rm -f $lockfile
+ [ $RETVAL -eq 0 ] && rm -f "$lockfile"
return $RETVAL
}
@@ -111,4 +110,4 @@ case "$1" in
;;
esac
-exit $?
+exit $?
\ No newline at end of file
diff --git a/contrib/init/stacks.service b/contrib/init/stacks.service
index e6b5e5cad..5472b120a 100644
--- a/contrib/init/stacks.service
+++ b/contrib/init/stacks.service
@@ -24,7 +24,7 @@ PermissionsStartOnly=true
####################
Type=simple
PIDFile=/run/stacks-blockchain/stacks-blockchain.pid
-Restart=on-failure
+Restart=no
TimeoutStopSec=600
KillSignal=SIGTERM
diff --git a/docs/init.md b/docs/init.md
index 01b99b52e..f3b98076c 100644
--- a/docs/init.md
+++ b/docs/init.md
@@ -82,7 +82,9 @@ setting the STACKS_BLOCKCHAIN_CONFIG and STACKS_BLOCKCHAIN_LOG environment varia
Copy org.stacks.stacks-blockchain.plist into ~/Library/LaunchAgents. Load the launch agent by
running `launchctl load ~/Library/LaunchAgents/org.stacks.stacks-blockchain.plist`.
-This Launch Agent will cause the stacks-blockchain to start whenever the user logs in.
+This Launch Agent will **not** start the stacks-blockchain whenever the user logs in.
+
+To start the service, you'll need to manually run the start command: `launchctl start org.stacks.stacks-blockchain`
NOTE: This approach is intended for those wanting to run stacks-blockchain as the current user.
You will need to modify org.stacks.stacks-blockchain.plist if you intend to use it as a
@@ -90,4 +92,4 @@ Launch Daemon with a dedicated stacks user.
## Auto-respawn
-Auto respawning is currently only configured for systemd.
+Auto respawning is currently disabled.