26 lines
1016 B
Bash
Executable File
26 lines
1016 B
Bash
Executable File
#!/bin/bash
|
|
chmod +x create_code_server.py
|
|
python3 -m venv code_venv
|
|
source ./code_venv/bin/activate
|
|
pip install -q hcloud
|
|
echo "############################"
|
|
echo "Let's clean everything from last run..."
|
|
python create_code_server.py --clean
|
|
echo "--------------------------------------------------------------------------"
|
|
echo " Success! I guess..."
|
|
echo "############################"
|
|
echo "Let's spawn some new machines!"
|
|
python create_code_server.py $1 --create
|
|
current_ip=$(<current_ip.txt)
|
|
echo "Your server's current IP is: $current_ip"
|
|
echo "Now let's wait for the machines to be ready..."
|
|
seconds=100
|
|
start="$(($(date +%s) + $seconds))"
|
|
while [ "$start" -ge `date +%s` ]; do
|
|
time="$(( $start - `date +%s` ))"
|
|
printf '%s\r' "$(date -u -d "@$time" +%H:%M:%S)"
|
|
done
|
|
echo "Let's try to get create a ssh tunnel and play..."
|
|
ssh-keygen -f "/home/${USER}/.ssh/known_hosts" -R "$current_ip"
|
|
ssh -oStrictHostKeyChecking=accept-new root@$current_ip -i $1 -L 8888:127.0.0.1:8443
|