-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy
More file actions
executable file
·37 lines (34 loc) · 1.77 KB
/
deploy
File metadata and controls
executable file
·37 lines (34 loc) · 1.77 KB
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
#!/bin/bash
SERVERS="198.101.247.249 198.101.245.182 50.56.178.240 198.101.247.220 198.61.172.118 198.61.172.161 198.61.172.30 198.61.172.184"
SERVERS="198.101.247.249"
USR="user"
for host in $SERVERS
do
if [ $1 == "publickey" ]; then
# For setting up public key crap. After this no more pass entry.
cat '.ssh/id_rsa.pub' | ssh $USR@$host 'cat - >> ~/.ssh/authorized_keys2'
elif [ $1 == "setup" ]; then
# For installing git
ssh -t $USR@$host 'mkdir .ssh; touch .ssh/authorized_keys2; sudo apt-get -y update; sudo apt-get install git-core;' &
elif [ $1 == "initialize" ]; then
# For cloning project, and installing pyhole dependencies
ssh -t $USR@$host 'git clone "https://github.com/rishair/cs-4284.git"; sudo apt-get -y install python python-pip python-dev build-essential; cd cs-4284/pyhole; sudo pip install -r tools/pip-requires; ./tools/run_pyhole.sh;' &
elif [ $1 == "branch" ]; then
# Switch branches
ssh -t $USR@$host "cd cs-4284; git checkout -b $2 origin/$2; git checkout $2; git pull origin $2"
elif [ $1 == "update" ]; then
# For updating project.
ssh -t $USR@$host 'cd cs-4284; git pull;'
elif [ $1 == "run_summarizer" ]; then
# For running bot. Note this puts each session in background. You can run this multiple times to put multiple bots on a machine.
ssh -t $USR@$host 'cd cs-4284/pyhole; cp configs/summarizer.conf ~/.pyhole/pyhole.conf; ./tools/run_pyhole.sh' &
elif [ $1 == "run" ]; then
# For running bot. Note this puts each session in background. You can run this multiple times to put multiple bots on a machine.
ssh -t $USR@$host 'cd cs-4284/pyhole; cp configs/custom.conf ~/.pyhole/pyhole.conf; ./tools/run_pyhole.sh' &
elif [ $1 == "kill" ]; then
# Kill bots.
ssh -t $USR@$host 'pkill python' &
else
echo "Unkown command: $1"
fi
done