comparison bin/sat @ 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 8b36e5c3f28f
children e81ad34e8af8
comparison
equal deleted inserted replaced
3098:518208085dfb 3099:0b6d56a8f7e3
1 #!/bin/sh 1 #!/bin/sh
2 2
3 DEBUG="" 3 DEBUG=""
4 DAEMON="" 4 DAEMON=""
5 PYTHON="python3" 5 PYTHON="python3"
6 TWISTD="$(which twistd)" 6
7 # for Python 3, "twistd" is named "twistd3" on some distros, so we check for it first
8 TWISTD="$(which twistd3 2>/dev/null)"
9 if [ $? -ne 0 ]; then
10 TWISTD="$(which twistd 2>/dev/null)"
11 fi
12 if [ $? -ne 0 ]; then
13 printf "Can't find \"twistd\" script, are you sure that Twisted is installed?\n"
14 exit 1
15 fi
7 16
8 kill_process() { 17 kill_process() {
9 # $1 is the file containing the PID to kill, $2 is the process name 18 # $1 is the file containing the PID to kill, $2 is the process name
10 if [ -f $1 ]; then 19 if [ -f $1 ]; then
11 PID=`cat $1` 20 PID=`cat $1`