changeset 3099:0b6d56a8f7e3

bin: look for twistd3 first: on some GNU/Linux discributions, `twistd` script is named `twistd3`, so sat script is now looking for `twistd3` first. If none is found, a message is printed on stderr and the script exit with an error code.
author Goffi <goffi@goffi.org>
date Fri, 27 Dec 2019 13:30:20 +0100
parents 518208085dfb
children cea52c9ddfd9
files bin/sat
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bin/sat	Fri Dec 20 14:26:05 2019 +0100
+++ b/bin/sat	Fri Dec 27 13:30:20 2019 +0100
@@ -3,7 +3,16 @@
 DEBUG=""
 DAEMON=""
 PYTHON="python3"
-TWISTD="$(which twistd)"
+
+# for Python 3, "twistd" is named "twistd3" on some distros, so we check for it first
+TWISTD="$(which twistd3 2>/dev/null)"
+if [ $? -ne 0 ]; then
+	TWISTD="$(which twistd 2>/dev/null)"
+fi
+if [ $? -ne 0 ]; then
+  	printf "Can't find \"twistd\" script, are you sure that Twisted is installed?\n"	
+	exit 1
+fi
 
 kill_process() {
     # $1 is the file containing the PID to kill, $2 is the process name