forked from waveshareteam/ugv_ws
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathros2_humble.sh
More file actions
27 lines (25 loc) · 851 Bytes
/
ros2_humble.sh
File metadata and controls
27 lines (25 loc) · 851 Bytes
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
#!/bin/bash
# Function to start the container
enter_container() {
if find / -name "ugv_jetson" 2>/dev/null | grep -q "ugv_jetson"; then
container_name="ugv_jetson_ros_humble"
else
container_name="ugv_rpi_ros_humble"
fi
echo "Entering the container..."
docker start "$container_name"
if [ $? -eq 0 ]; then
echo "Container started successfully."
echo "Executing docker exec command to open a bash shell in the container..."
docker exec -it "$container_name" /bin/bash -c "service ssh start"
if [ $? -eq 0 ]; then
echo "Opened bash shell in the container."
else
echo "Failed to open bash shell in the container."
fi
else
echo "Failed to enter the container, please check the error."
fi
}
# Call the function
enter_container