Mercurial > libervia-web
comparison src/libervia.sh @ 983:8c9fdb58de5f
server (libervia.sh): force python 2 to launch twistd, and avoid launching wrong version if twistd is installed for python 3 too
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 17 Nov 2017 11:01:34 +0100 |
parents | acde4b729034 |
children | a6bef71a7fd0 |
comparison
equal
deleted
inserted
replaced
982:a78169c1bf77 | 983:8c9fdb58de5f |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 DEBUG="" | 3 DEBUG="" |
4 DAEMON="" | 4 DAEMON="" |
5 PYTHON="python2" | 5 PYTHON="python2" |
6 TWISTD="$(which twistd)" | |
6 | 7 |
7 kill_process() { | 8 kill_process() { |
8 # $1 is the file containing the PID to kill, $2 is the process name | 9 # $1 is the file containing the PID to kill, $2 is the process name |
9 if [ -f $1 ]; then | 10 if [ -f $1 ]; then |
10 PID=`cat $1` | 11 PID=`cat $1` |
101 log_dir=`dirname "$LOG_FILE"` | 102 log_dir=`dirname "$LOG_FILE"` |
102 if [ ! -d $log_dir ] ; then | 103 if [ ! -d $log_dir ] ; then |
103 mkdir $log_dir | 104 mkdir $log_dir |
104 fi | 105 fi |
105 | 106 |
106 exec twistd $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE $PLUGIN_OPTIONS $@ | 107 exec $PYTHON $TWISTD $MAIN_OPTIONS $ADDITIONAL_OPTIONS $APP_NAME_FILE $PLUGIN_OPTIONS $@ |