This repository has been archived by the owner on Jun 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartRemoteElevator.sh
executable file
·71 lines (65 loc) · 2.19 KB
/
startRemoteElevator.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
70
71
#!/bin/bash
# This script automaticaly copies project folder to new computer, and does a remote login afterwords
clear
user="student"
echo "Type in the workstation number to start"
read workstationNumber
if [ $workstationNumber == "1" ]; then
IP=140
elif [ $workstationNumber == "2" ]; then
IP=149
elif [ $workstationNumber == "3" ]; then
IP=150
elif [ $workstationNumber == "4" ]; then
IP=141
elif [ $workstationNumber == "6" ]; then
IP=146
elif [ $workstationNumber == "7" ]; then
IP=154
elif [ $workstationNumber == "10" ]; then
IP=155
elif [ $workstationNumber == "11" ]; then
IP=159
elif [ $workstationNumber == "12" ]; then
IP=144
elif [ $workstationNumber == "13" ]; then
IP=152
elif [ $workstationNumber == "14" ]; then
IP=142
elif [ $workstationNumber == "15" ]; then
IP=148
elif [ $workstationNumber == "17" ]; then
IP=145
elif [ $workstationNumber == "18" ]; then
IP=151
elif [ $workstationNumber == "20" ]; then
IP=155
elif [ $workstationNumber == "21" ]; then
IP=153
elif [ $workstationNumber == "22" ]; then
IP=38
elif [ $workstationNumber == "23" ]; then
IP=48
elif [ $workstationNumber == "24" ]; then
IP=46
else
echo "Not a valid workstation"
exit 1
fi
#ssh [email protected]
#ssh -t [email protected].$IP
# Create new rsa key
#ssh-keygen
#-t rsa # uncomment when starting from a new computer
# Send RSA key to remote conputer
#cat ~/.ssh/id_rsa.pub | ssh [email protected].$IP 'cat >> .ssh/authorized_keys'
##echo "Connecting to Workstation" $workstationNumber "at 129.241.187."$IP
#ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected].$IP
echo "Delete old files and folder"
ssh [email protected].$IP 'rm -rf ~/work/src/github.com/andersliland/ttk4145-project/'
echo "Create new folder path"
ssh [email protected].$IP 'mkdir -p ~/work/src/github.com/andersliland/ttk4145-project' # create directory path if it does not exsist
echo "Copy project content"
scp -rq ~/work/src/github.com/andersliland/ttk4145-project/. [email protected].$IP:~/work/src/github.com/andersliland/ttk4145-project &>/dev/null
echo 'SSH into remote and execute go run main.go'
ssh -t [email protected].$IP "cd /home/student/work/src/github.com/andersliland/ttk4145-project/ && ./setupRemote.sh ; bash"