Auto-start/service scripts for the EMS on a Raspberry Pi

    Hi,

     

    I have just been playing around with the Edge MicroServer on a couple of Raspberry Pi's.  I obviously want them connected to ThingWorx, however they stop when the SSH session closes which isn't ideal.  I thought about doing something really quick and dirty using 'nohup', but this could have lead to many running processes, and wouldn't still not have started automatically when the Pi booted.  So, I did it right instead using init.d daemon configurations.

     

    There are two files; one for the EMS and one for the Lua Script Resource.  You need to put these in /etc/init.d, then make sure they are owned by root.

     

    sudo chown root /etc/init.d/thingworx*
    sudo chgrp root /etc/init.d/thingworx*
    

     

    You'll need to modify the paths in the first lines of these files to match where you have your microserver folder.  Then you need to update the init.d daemon configs and enable the services.

     

    sudo update-rc.d thingworx-ems defaults
    sudo update-rc.d thingworx-ems enable
    sudo update-rc.d thingworx-lsr defaults
    sudo update-rc.d thingworx-lsr enable
    

     

    You can then start (stop, etc.) like this:

     

    sudo service thingworx-ems start
    sudo service thingworx-lsr start
    

     

    They should both also start automatically after a reboot.

     

    Regards,

     

    Greg