forked from udiboy1209/fast_playlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver
executable file
·46 lines (43 loc) · 1.02 KB
/
server
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
44
45
46
#!/bin/bash
function check(){
if [ "$(pkill -c -f SimpleHTTPServer)" != "0" -a "$(pkill -c -f scss)" != "0" ]
then
echo "Server and Scss processes found"
return 0
else
echo "Server and Scss not running"
return 1
fi
}
if [ -n "$1" ]
then
if [ $1 == 'start' ]
then
if ! check
then
python -m SimpleHTTPServer 8080 &> _logs/server.log &
scss --watch _scss/main.scss:css/main.css &> _logs/scss.log &
echo "Server started at http://localhost:8080"
fi
elif [ $1 == 'stop' ]
then
if check
then
pkill -e -f SimpleHTTPServer
pkill -e -f scss
echo "Server and Scss stopped"
fi
elif [ $1 == 'check' ]
then
check
else
echo "Invalid command."
echo "Usage ./server <command>"
echo
echo "Commands available: start|stop"
fi
else
echo "Usage ./server <command>"
echo
echo "Commands available: start|stop"
fi