-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstartwebserver
executable file
·44 lines (31 loc) · 1.19 KB
/
startwebserver
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
#!/bin/sh
# A simple utility to start the webserver in a real installation,
# Do not forget to edit to your own needs. This file also works great with
# crontab for automatic scheduling.
# Do not forget to change paths!
if [ $1 = "start" ]; then
# Kill the idleserver if it is running
pkill -f "python3 src/idleserver.py"
sleep 5
# Start the lightserver if it is not running
if [ $(pgrep -f "python3 src/lightserver.py" | wc -l) -eq 0 ] ; then
pkill -f "python3 src/webserver.py"
cd ~/playhouse/playhouse-lights/ # This path
python3 src/lightserver.py &
sleep 5
fi
# Start the webserver if it is not running
if [ $(pgrep -f "python3 src/webserver.py" | wc -l) -eq 0 ] ; then
cd ~/playhouse/playhouse-web # And this path
python3 src/webserver.py &
fi
elif [ $1 = "stop" ]; then
# Stop the webserver
pkill --signal sigint -f "python3 src/webserver.py"
sleep 5
# Start the idle server if it is not running
if [ $(pgrep -f "python3 src/idleserver.py" | wc -l) -eq 0 ] ; then
cd ~/playhouse/playhouse-web # And this path
python3 src/idleserver.py &
fi
fi