-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathICUSBProxy.sh
executable file
·43 lines (38 loc) · 986 Bytes
/
ICUSBProxy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# Change port and verbosity if necessary
PORT=1234
VERBOSE=0
# Don't change anything from there if you don't know what you are doing...
PATH_SCRIPT='ICUSBProxy.py'
PATH_LOG='/tmp'
BASEDIR=$(dirname $0)
PID=`/usr/bin/pgrep -f ${BASEDIR}/${PATH_SCRIPT}`
# If no argument
if [ -z "$1" ]; then
if [ -z "$PID" ]; then
set -- 'start'
else
set -- 'stop'
fi
fi
case "$1" in
start)
echo "Starting ICUSBProxy"
if [ -z "$PID" ]; then
nohup python3 ${BASEDIR}/${PATH_SCRIPT} ${PORT} ${VERBOSE} > $PATH_LOG/ICUSBProxy.log 2>&1 &
fi
;;
restart)
echo "Restarting ICUSBProxy"
if [ ! -z "$PID" ]; then
kill -9 "${PID}"
fi
nohup python3 ${BASEDIR}/${PATH_SCRIPT} ${PORT} ${VERBOSE} > $PATH_LOG/ICUSBProxy.log 2>&1 &
;;
stop)
echo "Stopping ICUSBProxy"
if [ ! -z "$PID" ]; then
kill -9 "${PID}"
fi
;;
esac