-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_script.sh
More file actions
31 lines (22 loc) · 1.06 KB
/
deploy_script.sh
File metadata and controls
31 lines (22 loc) · 1.06 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
#!/bin/bash
# Define the base IP address
BASE_IP="192.168.42."
# Loop through the range from 10 to 109, excluding 12
for i in {108..108}; do
TARGET_IP="${BASE_IP}${i}"
echo "Connecting to ${TARGET_IP}..."
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -A -i /home/lorenzo/Scrivania/lavoro/ssh.key -J user@130.251.7.71 root@"${TARGET_IP}" << 'ENDSSH'
echo "Updating system packages..."
sudo apt update
echo "Installing Docker..."
sudo apt install docker.io -y
echo "Pulling Docker image..."
docker pull docker.io/lorenzofoschi/stonkspp_debug:latest
echo "Running Docker container..."
docker run -p 2222:22 --privileged --cgroupns=host --name stonkss --security-opt apparmor=unconfined lorenzofoschi/stonkspp_debug:latest &
echo "Executing command inside the container..."
sleep 20
docker exec -d stonkss /bin/bash -c "cd ../cosima_core/mosaik_sim/ && sudo nohup python3 runs.py > nohup.out 2>&1 &"
ENDSSH
echo "Commands executed on ${TARGET_IP}."
done