MySensors gateway running as a service
-
I have an RPi Zerwo 2w that I am running headless. It is running the minimal version of RaspberryPi OS (no GUI). I can run MySensors Gateway (mysgw) in a ssh sesstion. I would like to run mysgw as a service.
Granted, I would get no output, but it is running well.
Well, community, have you ever done this?
-
@OldSurferDude everyone who has run make install has it running as a service. See the Install section at https://web.archive.org/web/20220306231732/https://www.mysensors.org/build/raspberry
https://github.com/mysensors/MySensors/pull/1421 adds support for more than one gateway on the same machine. You’ll need to configure them to use different eeprom files though, see my note in the PR.
-
I think I got it working.
note: I use UNAME here. Usually its pi
create directory ~/.config
create the file ~/.config/autostart.sh with the contents:# # must use full path because at this point in the # process, the user is not logged in # log the time of boot date -R >/home/UNAME/lastboot # wait a little bit to ensure network is up sleep 5 # Start the gateway # pipe stdout and stderr to the null file so that loose characters are not flying about # end with an & to the boot to complete and let the gateway run /home/UNAME/MySensors/bin/mysgw >>/dev/null 2>>/dev/null &
make this file executable
sudo chmod +x ~/.config/autostart.sh
Get the autostart program to run at boot by modifying
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi # add this line # ampersand is very important! /home/UNAME/.config/autostart.sh & exit 0
ensure that rc.local is executable
sudo chmod +x /etc/rc.local
-
Suggested Topics
-
Data collection
My Project • 22 Sept 2014, 00:36 • pvoj 22 Sept 2014, 01:52 -
💬 HALO : ESP32 multi transport GW/Bridge for Mysensors
OpenHardware.io • 29 May 2017, 10:43 • openhardware.io 15 Dec 2019, 18:25 -
Multiple virtual nodes on a gateway
Troubleshooting • 7 Feb 2019, 16:00 • pvoj 12 Feb 2019, 23:14 -
ESP8266 Gateway start without WiFi connection
Troubleshooting • 17 Nov 2017, 11:26 • LeoDJ 17 Nov 2017, 11:26 -
💬 NRF52 Gateway -(RFM69-option)
OpenHardware.io • 27 Apr 2018, 20:53 • openhardware.io 17 Mar 2019, 15:02 -
st=fail on gateway
Troubleshooting • 8 Feb 2015, 20:29 • cayco 10 Feb 2015, 18:17 -
RFM69HW antenna
General Discussion • 4 Jul 2019, 13:42 • tsunami 8 Jul 2019, 09:45 -
testing with different controllers (mqtt brokers)
Controllers • 4 Jan 2023, 16:48 • OldSurferDude 5 Jan 2023, 07:26