Skip to content

Commit

Permalink
fixed healthcheck_node.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
delihus committed Jul 24, 2024
1 parent 14a64d9 commit c8db8b5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions run_healthcheck_node.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
source "/ros2_ws_healthcheck/install/setup.bash"
gosu $USER bash -c "ros2 run healthcheck_pkg healthcheck_node &"
if [ ! -z "$USER" ] && [ "$USER" != "root" ] && [ "$USER" != "$(whoami)" ]; then
# Check if the user already exists; if not, create the user
if ! id "$USER" &>/dev/null; then
useradd -ms /bin/bash "$USER"
echo "[ \"\$(whoami)\" != \"$USER\" ] && su - \"$USER\"" >> /etc/bash.bashrc
fi

source "/ros2_ws_healthcheck/install/setup.bash"

exec gosu $USER /bin/bash -c "ros2 run healthcheck_pkg healthcheck_node &"

else
source "/ros2_ws_healthcheck/install/setup.bash"
ros2 run healthcheck_pkg healthcheck_node &
fi

0 comments on commit c8db8b5

Please sign in to comment.