-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-website.sh
45 lines (38 loc) · 1.01 KB
/
run-website.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
44
45
#!/bin/bash
# utility functions
# ***********************************
function free_port() {
if [ -z $1 ]
then
echo no Port given
else
PORT=$1;
PID=$(sudo lsof -i :$PORT) # store the PID, that is using this port
if [ -z $PID ]
then
echo port: $PORT is already free.
else
sudo kill -9 $PID # kill the process, which frees the port
echo port: $PORT is now free.
fi
fi
}
# main method
# ***********************************
# 01. run database server
sudo service mongod start
# 02. back-end server
cd "./back end/"
free_port 8001
gnome-terminal -e "npm install" #install packages
gnome-terminal -e "node main.js" #node main.js
# 02. run media server
cd "../media"
free_port 8000
gnome-terminal -e "python -m http.server 8000"
gnome-terminal -e "python -m SimpleHTTPServer 8000"
# 02. run front-end server
cd "../front end/"
free_port 3000
gnome-terminal -e "npm install" #install packages
gnome-terminal -e "npm start"