forked from GoogleChromeLabs/MiniMobileDeviceLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.sh
executable file
·43 lines (34 loc) · 839 Bytes
/
server.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/bash
# server.sh - Starts the MMDL Server
echo Getting latest bits...
git pull
echo Starting Mini Mobile Device Lab Server
current_commit=$(git rev-list HEAD --max-count=1 | cut -c1-7)
echo ""
echo Current commit ${current_commit}
echo "${current_commit}" > version.txt
cd PiLab
echo ""
echo Starting Monitor...
forever start monitor.js
echo ""
echo Starting ADB Server with sudo
sudo adb start-server
echo ""
echo Installing and updating node modules
npm install
echo ""
echo Starting MMDL Server
OUTPUT=$(node server.js 2>&1 >/dev/tty)
echo "${OUTPUT}"
date >> last_failure.txt
echo "" >> last_failure.txt
echo "${OUTPUT}" >> last_failure.txt
echo "" >> last_failure.txt
echo "" >> last_failure.txt
echo "-----" >> last_failure.txt
echo "" >> last_failure.txt
echo ""
echo Rebooting in 30 seconds...
sleep 30
sudo reboot