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

Service does not start on boot on Raspbian #21

Closed
alexbbb opened this issue Feb 16, 2015 · 3 comments
Closed

Service does not start on boot on Raspbian #21

alexbbb opened this issue Feb 16, 2015 · 3 comments

Comments

@alexbbb
Copy link

alexbbb commented Feb 16, 2015

How to reproduce the error:
Raspbian wheezy on RaspberryPi Model B, with node.js 0.10.36 for ARM got from here: http://node-arm.herokuapp.com/node_0.10.36_armhf.deb, forever 0.14.1 and forever-service 0.4.4.
Run this as root:

apt-get install wget
wget http://node-arm.herokuapp.com/node_0.10.36_armhf.deb
dpkg -i node_0.10.36_armhf.deb
npm install -g forever
npm install -g forever-service

Then create this little app:

var express = require('express');
var app = express();

app.get('/', function(req, res){
  res.send('hello world');
});

app.listen(3000);

and install it as a service:

forever-service install myservice --script app.js -p $(dirname "$(which forever)")

Reboot the raspberry and at boot the service will not get started.

To make it work, the only way I've found so far is to manually edit /etc/init.d/myservice script and add:

# Add node, npm and forever path
export PATH=/usr/local/bin:$PATH

before:

# Check if any of $pid (could be plural) are running
@alexbbb
Copy link
Author

alexbbb commented Feb 16, 2015

Also tried setting the command line parameter

-c /usr/local/bin/node

on each forever call, without exporting PATH, but it doesn't work

@arvind-agarwal
Copy link
Contributor

I have done some changes in 0.4.5 to allow -e env variables to be setup as global variables rather than specific to forever command line.

So now you can use -e "PATH=/usr/local/bin:$PATH" as the parameter in forever-service cli to add the PATH variable to your startup script

@alexbbb
Copy link
Author

alexbbb commented Feb 16, 2015

@arvind-agarwal it works like a charm! Just updated forever-service and tried it! Awesome job, thank you!

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