I am running the Gateway on a Raspberry Pi 3. When bringing up the Dashboard in a browser, I get the message "Waiting for Socket Connection". I need to manually run the command "node gateway.js" to get a connection. I tried putting this command in the .bashrc file. The command is executed when I login to the Pi with an xterm session (but not on bootup).
When I execute "sudo systemctl start gateway", I get the following error:
Failed to start gateway.service: Unit gateway.service failed to load: No such file or directory.
Any ideas of the configuration needed to startup the connection on bootup of the Raspberry Pi?
Thank you.
I had this problem twice because, for some reason, the gateway.service file didn't get copied.
I solved with (instead of $APPSRVDIR i wrote the folder where .setup/gateway.service is to be found):
sudo cp $APPSRVDIR/.setup/gateway.service /etc/systemd/system/ (practically, you need to copy gateway.service in /etc/systemd/system and then start the service or reboot the Pi)
Thank you for the help!
I copied the file as you suggested, but unfortunately this did not seem to help.
It looks like the script gateway.service should write output to a log file in ~/gateway/logs, but that file is not created:
ExecStart=/bin/sh -c '/usr/bin/node /home/pi/gateway/gateway.js >> /home/pi/gate
way/logs/gateway.sys.log 2>&1'
Try this:
sudo cp $APPSRVDIR/.setup/gateway.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable gateway.service
sudo systemctl start gateway.service
Quote from: Kylix on May 14, 2018, 03:21:38 AM
I had this problem twice because, for some reason, the gateway.service file didn't get copied.
I tested the setup script a few days ago and it works. If the file does not get copied there's some other problem.
If you get an error during setup please include it here.
I suggest trying the setup again on a new raspbian lite install. It should work.
The command "sudo systemctl restart gateway" no longer gives an error message,
however "sudo systemctl stop gateway" does not appear to shutdown the gateway.
Hi Felix,
I noted this problem a few times. During the gateway install, raspi-config starts before the script finishes. After making the changes in raspi-config, it asks for reboot to apply them and the gateway script doesn't finish it's job.
I'm always using the Lite version.
Quote from: r.rabin on May 14, 2018, 10:33:42 AM
The command "sudo systemctl restart gateway" no longer gives an error message,
however "sudo systemctl stop gateway" does not appear to shutdown the gateway.
try a reboot and then check the gateway log ...
Quote from: Kylix on May 14, 2018, 10:36:08 AM
raspi-config starts before the script finishes
How does that happen? Do you run raspi-config from the setup prompt?
It just pops up during the gateway install. I only execute the gateway install script. It may be something that triggers it. I think it happens just before copying the gateway.service
It should only run if you say YES in the prompt. No external process are invoked/run automatically. There is a prompt that asks you if you want to run it during the Gateway setup.
Pick NO if you dont want that to run.
It was added as a convenience, but maybe should be removed. Or maybe there's a way to block the invoking process while that runs. Or maybe move it at the very end.
It should be invoked only after the gateway install script has finished, if possible.
I agree, meanwhile if this is causing trouble please skip it.
I am able to get the gateway to start on boot by adding a script to:
/etc/init.d/script.sh
where the script executes:
/bin/sh -c '/usr/bin/node /home/pi/gateway/gateway.js' & >> /home/pi/gateway/log
s/gateway.sys.log 2>&1