forked from BrowserBox/BrowserBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·69 lines (56 loc) · 1.58 KB
/
start.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
let audio=$2-2
let console=$2-1
let devtools=$2+1
let chat=$2+2
username=$(whoami)
echo "Starting viewfinder service cluster as $username"
echo "Trapping SIGINT to kill 3 child-processes: parec-server, pptr-console-server
and crdp-secure-proxy-server."
trap 'kill $BGPID1; kill $BGPID2; kill $BGPID3; exit' SIGINT
echo "Loading nvm"
cd $HOME
source .nvm/nvm.sh
source .profile
source .bashrc
cd $HOME/vf
node=$(which node)
echo "Starting pulseaudio"
sudo -g browsers pulseaudio -k
sudo -g browsers pulseaudio --start
echo "Starting parec-server"
cd parec-server
pwd
sudo -g browsers $node index.js $audio rtp.monitor $3 $5 &
BGPID1=$!
cd ..
echo "Starting pptr-console-server"
cd pptr-console-server
pwd
sudo -g browsers $node index.js $console $3 $5 &
BGPID2=$!
echo "Starting chat server"
cd websocket_chat_app_homework
pwd
sudo -g browsers $node index.js $chat $3 $5 &
BGPID5=$!
cd ..
cd ..
# The below two services cannot run in browsers group
# because they both need access to the 5000-7999 ports
# perhaps in future a separate cgroup for resource usage can be used on them
# but in fact that's not needed
# because they already run (sudo cgexec - ... browsers) within the "browsers" cgroup
# the browsers "cgroup" and the user group "browsers" are actually distinct things
# so this is all good and as good as it can be
# and also
# FUCK YEAH! :P ;) xx I FUCKING ROCK
echo "Starting crdp-secure-proxy-server"
cd crdp-secure-proxy-server
pwd
$node index.js $devtools $3 $5 &
BGPID3=$!
cd ..
echo "Starting main process, viewfinder, in foreground"
pwd
$node server.js $1 $2 $3 $username $5