From ebe0cbe0d2440caf904705394b0b78c099f162fa Mon Sep 17 00:00:00 2001 From: Tanushree Hadavale <147886719+thadavale@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:07:26 -0500 Subject: [PATCH] Create start_gps.sh --- NaviGator/scripts/start_gps.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 NaviGator/scripts/start_gps.sh diff --git a/NaviGator/scripts/start_gps.sh b/NaviGator/scripts/start_gps.sh new file mode 100644 index 000000000..1ac3a4bad --- /dev/null +++ b/NaviGator/scripts/start_gps.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Create systemd service +service_file='/etc/systemd/system/sdgps.service' + +# Remove existing service file if it exists +if [ -f $service_file ]; then + rm $service_file +fi + +# Write the content of the service file without outputting to terminal +echo '[Unit]' > $service_file +echo 'Description=Start GPS Service for NaviGator' >> $service_file +echo 'After=network.target' >> $service_file +echo '' >> $service_file +echo '[Service]' >> $service_file +echo 'ExecStart=NaviGator/mission_control/navigator_launch/launch/hardware/gps.launch' >> $service_file +echo 'User=navigator' >> $service_file +echo 'Restart=always' >> $service_file +echo '' >> $service_file +echo '[Install]' >> $service_file +echo 'WantedBy=multi-user.target' >> $service_file + +# Reload systemd to recognize the new service +systemctl daemon-reload +systemctl enable sdgps.service +systemctl start sdgps.service