-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpatchserver
70 lines (58 loc) · 2.21 KB
/
patchserver
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
70
#!/bin/bash
#
# TODO
# - npm install/update? (what if we change packages.json?)
# - get rid of the rm dist/fuckingtaskrunner.json; this is unecessary
# - Check Dreamhost password correct before starting
# - Turn off server (w/out errors) before starting -- what if there's an inspector waiting though?
# - SCP once (seems login is incredibly slow, but actual copying is fast)
# - View initial server start log? Or some way to show that the server has successfully started?
# - Fix killing node: scary to kill ALL node, we only want to kill server/resourceBuilder/fuckingtaskrunner?
printf "Enter the password for Dreamhost: "
read -s passphrase
# Wtf???
scp -i ~/home/awskeypair.pem -r dist/js/SCRIPTINJECT.js [email protected]:~/myquest/dist/js/
ssh -i ~/home/awskeypair.pem -t [email protected] << EOF
cd myquest
git checkout -- .
# Kill existing server
sudo ps aux | grep -i [w]atchreports | awk '{ print \$2 }' | xargs kill -9 \$1
sudo ps aux | grep -i [r]unserver | awk '{ print \$2 }' | xargs kill -9 \$1
sudo ps aux | grep -i [n]ode | awk '{ print \$2 }' | xargs kill -9 \$1
rm patchserver.out
git pull 2>patchserver.out
# Pull latest
if grep -q "error" "patchserver.out"; then
echo "ERROR ======"
cat patchserver.out
echo "============"
echo "Aborting Patch.."
exit
fi
# Update perms
sudo chmod -R 000 tools/
sudo chmod +x build-scripts
sudo chmod +x emailcrash
sudo chmod +x watchreports
sudo chmod +x runserver
# Build game scripts/resources
#rm -r dist
#rm fuckingtaskrunner.json
#mkdir dist
#mkdir dist/js
#mkdir dist/js/server
#mkdir dist/js/server/test
#mkdir dist/js/client
#mkdir dist/js/client/test
#mkdir dist/js/scripts
#mkdir dist/js/test
#mkdir dist/js/lib
node resourceBuilder.js
node fuckingtaskrunner.js --dont-watch
# SCP game to webserver
sshpass -p "$passphrase" rsync -avP ./{dist,node_modules,index.html,styles.css} [email protected]:~/jbud.me/playground/myquest/
# Running server
nohup ./watchreports > watchreports.out 2> watchreports.err < /dev/null &
nohup ./runserver > nohup.out 2> nohup.err < /dev/null &
echo "Finished patching"
EOF