I have just found a Node.js app that is run from the command line as follows
node tuya-mqtt.js
This app lets me control and monitor my new heatpump system using mqtt
I run node red on a VM so have plenty of grunt and memory available - is there an easy way to get this app to run in the background on startup of the machine ?
I know this is not strictly a NR question - but doing a google search has led me down a rabbit warren and i do not want to bugger up the machine running my main NR flow
If it just runs as root the "old fashioned easy way" is just to add it to /etc/rc.local - you would need to fully path both the executable and the script name but is an easy fix.
yeah seems to run fine as root - just trying to get it to run as a restricted user (pi) and having problems as it does not seem to understand paths to find the config files - just trying to work through permutations on that before i thrown in the towel and just run it as root
In fact it must be something i am doing/not understanding.
I can run it from the commandline as the pi user from within its own directory (under the home directory for the pi user) - but when i run it as a service it is having problems - must be something to do with paths to pass into the service - just trying to understand how to do that one
When you run from systemd, don't forget that you don't get any of the usual environment variables - like path. However, there are ways to inherit them if you need to. You'll need to look that up I'm afraid, systemd has too many options to just remember