Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forever-service Not working!! #82

Open
Jarvis785 opened this issue Oct 29, 2016 · 7 comments
Open

forever-service Not working!! #82

Jarvis785 opened this issue Oct 29, 2016 · 7 comments

Comments

@Jarvis785
Copy link

Jarvis785 commented Oct 29, 2016

i had a simple LED blink code nodejs
i have tested by command :node /home/pi/blink.js (its blinking !! working..)

sudo forever-service install IOT --script /home/pi/blink.js

sudo service IOT start (it gives no error)
sudo service IOT status (it says running)
IOT.service - LSB: forever-service startup script for IOT
Loaded: loaded (/etc/init.d/IOT)
Active: active (running) since Sat 2016-10-29 20:17:00 UTC; 1min 46s ago
Process: 4217 ExecStart=/etc/init.d/IOT start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/IOT.service
└─2835 /usr/bin/nodejs /usr/lib/node_modules/forever/bin/monitor /home/pi/myblynk.js

Oct 29 20:17:00 Pi-Jarvis IOT[4217]: Service IOT already running
Oct 29 20:17:00 Pi-Jarvis systemd[1]: Started LSB: forever-service startup script for IOT.

But LED not blinking !! Why ?

ame program works if i use only forever :: forever /home/pi/blink.js start !!

but forever-service not working

@arvind-agarwal
Copy link
Contributor

Can you check the log file related to this service in /var/log and see if it has got console logs from your service?

@Jarvis785
Copy link
Author

Jarvis785 commented Nov 2, 2016

Found the error sir !! Its showing can not find module blynk-library... (I hv included this library in node program)

But running the same file using node x.js works ...

But why in forever service it is unable to fetch the library ??

is it due to the problem that the process can't acess global library

@arvind-agarwal
Copy link
Contributor

When provisioning the service i will usually advise to change the directory to the directory of the script and than provision the service, since this way when service is run it runs from same directory.

So i would suggest you do the following.

cd  /home/pi/ 
sudo forever-service install IOT --script blink.js

@Jarvis785
Copy link
Author

no sir .. doing
cd /home/pi/
sudo forever-service install IOT --script blink.js

gave the same result !!

@arvind-agarwal
Copy link
Contributor

In that case i cant exactly be more helpful on the issue, sometimes issue could be related to path / nodejs installation folder since services run under sudo context, and may not have exact environment (as running them normally from terminal) when you run them as sudo under service context.

So i guess you will have to do more debugging, since only thing forever-service does is invokes forever for your script. Beyond that it has no control on what goes on.

@arvind-agarwal
Copy link
Contributor

No idea, but why don't you give it a shot.

@Jarvis785
Copy link
Author

i had deleted that IOT.log .... now installing and running IOT again ... i can't found the log file again !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants