Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. MySensors gateway running as a service

MySensors gateway running as a service

Scheduled Pinned Locked Moved Development
gateway
4 Posts 2 Posters 27 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OldSurferDudeO Offline
    OldSurferDudeO Offline
    OldSurferDude
    wrote on last edited by
    #1

    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?

    mfalkviddM OldSurferDudeO 2 Replies Last reply
    0
    • OldSurferDudeO OldSurferDude

      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?

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      @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.

      OldSurferDudeO 1 Reply Last reply
      0
      • OldSurferDudeO OldSurferDude

        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?

        OldSurferDudeO Offline
        OldSurferDudeO Offline
        OldSurferDude
        wrote on last edited by
        #3

        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
        
        1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @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.

          OldSurferDudeO Offline
          OldSurferDudeO Offline
          OldSurferDude
          wrote on last edited by
          #4

          @mfalkvidd

          Thanks, I didn't see that!

          OSD

          1 Reply Last reply
          1
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          7

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular