Update direwolf.sh

This commit is contained in:
RaspbianProyect by HP3ICC 2023-07-06 02:08:37 +00:00
parent 8a0069359a
commit a79aa74e3f
1 changed files with 21 additions and 29 deletions

View File

@ -5,11 +5,7 @@ then systemctl stop direwolf.service
fi
if systemctl status gpsd.socket |grep active >/dev/null 2>&1
then systemctl stop gpsd.socket
fi
if systemctl status gpsd |grep active >/dev/null 2>&1
then systemctl stop gpsd
then systemctl stop gpsd.socket gpsd.service
fi
if [ -d "/opt/direwolf" ]
@ -64,7 +60,7 @@ fi
# GPSD
#########################################################################################################################
cat > /etc/udev/rules.d/49-usb-gps.rules <<- "EOF"
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyGPS"
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyGPS", RUN+="gpsctl --nmea"
EOF
cat > /etc/default/gpsd <<- "EOF"
@ -75,27 +71,6 @@ USBAUTO="true"
EOF
#sudo systemctl stop gpsd
#cat > /lib/systemd/system/gpsd.service <<- "EOFG"
#[Unit]
#Description=GPS (Global Positioning System) Daemon
#Requires=gpsd.socket
#After=chronyd.service
#[Service]
#Type=forking
#EnvironmentFile=-/etc/default/gpsd
#ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $OPTIONS $DEVICES
#Restart=on-failure
#RestartSec=5s
#[Install]
#WantedBy=multi-user.target
#lso=gpsd.socket
#EOFG
sudo ln -sf /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/
#sudo systemctl start gpsd
#archivo="/etc/ntp.conf"
@ -115,10 +90,14 @@ sudo ln -sf /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.targ
cat > /lib/systemd/system/tnmea.service <<- "EOFT"
[Unit]
Description=TNMEA Service
After=gpsd.service
Wants=gpsd.service
#After=direwolf.service
After=multi-user.target
Requires=gpsd.service
Wants=direwolf.service
[Service]
StandardOutput=null
ExecStartPre=sleep 30
ExecStart=gpsctl --nmea
Restart=always
RestartSec=3
@ -126,7 +105,20 @@ RestartSec=3
[Install]
WantedBy=default.target
EOFT
archivo="/lib/systemd/system/gpsd.service"
palabra=("Also=tnmea.socket")
for palabra in "${palabra[@]}"
do
if grep -i -E "$palabra" "$archivo" >/dev/null 2>&1; then
echo "line found"
else
echo "$palabra">> "$archivo"
fi
done
systemctl daemon-reload
systemctl start tnmea.service
systemctl enable tnmea.service