Harmony-API and Forever Service

I’ve got the Harmony API up and running using Forever to run it as a service, however, after an hour or two I need to go back to and restart the Forever service. When I check the status of the service however, it says that it is still active and running. Any ideas what the problem could be? Or could I add the service to a crontab so that it restarts ever hour or so? Thanks!

How are you checking the status? Are there any logs or output?

I use sudo service harmony status to check the status and below is what I receive back:

i@raspberrypi:~ $ sudo service harmony status
● harmony.service - LSB: forever-service startup script for harmony
Loaded: loaded (/etc/init.d/harmony)
Active: active (running) since Sat 2016-08-27 14:42:47 EDT; 20h ago
Process: 10883 ExecStop=/etc/init.d/harmony stop (code=exited, status=0/SUCCESS)
Process: 10901 ExecStart=/etc/init.d/harmony start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/harmony.service
├─10916 /usr/bin/nodejs /usr/lib/node_modules/forever/bin/monitor …
└─10925 /usr/bin/nodejs /home/pi/harmony-api/app.js

Aug 27 14:42:45 raspberrypi harmony[10901]: Starting harmony
Aug 27 14:42:47 raspberrypi systemd[1]: Started LSB: forever-service startup…

So the process is up (PID 10925). Does it respond to HTTP requests at all?

I’m not familiar with the way you’ve setup the service with forever. Does it log output somewhere? I’d bet something is going on to make it fail.

If you aren’t able to track down what is happening, it should be possible to add a cronjob to restart it, but it’d be better to find out at least why it’s not working.

No, after a random amount of time ( could be an hour , could be 12) , the service stops responding. I’m not sure if there are lots, I couldn’t find any in the user folder, but maybe in root. How do I add a service to a crontab? Tried a few different things, but none of them took

Check /hoe/pi/harmony-api/logs for logs. According to the docs that’s where it should be logigng.

This documentation from raspberry pi has some pointers on setting up cron stuff.

Thank you!