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

Issue while using peerflix-server with forever in an init.d script #10

Closed
zobrak opened this issue Oct 28, 2014 · 3 comments
Closed

Issue while using peerflix-server with forever in an init.d script #10

zobrak opened this issue Oct 28, 2014 · 3 comments

Comments

@zobrak
Copy link

zobrak commented Oct 28, 2014

Hi !
I was trying to launch peerflix server as a daemon with forever and I got always the same error while launching from an init.d script :

path.js:360
throw new TypeError('Arguments to path.join must be strings');
^
TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at Object. (/usr/lib/node_modules/peerflix-server/server/store.js:11:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
error: Forever detected script exited with code: 8
error: Script restart attempt #4

To resolv this issue I did edit the store.js file and did this :

  • homePath = '/root',
  • homePath = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'],

Now it works.

@asapach
Copy link
Owner

asapach commented Oct 28, 2014

The problem seems to be that the HOME environment variable is not set for the user you are running the script under. Can you try setting it explicitly?

@zobrak
Copy link
Author

zobrak commented Oct 28, 2014

In fact the HOME is set :
printenv | grep HOME

HOME=/root

@asapach
Copy link
Owner

asapach commented Nov 2, 2014

I'm using upstart on Ubuntu 14.04. Here's my config:
/etc/init/peerflix.conf

description "Peerflix daemon"
start on startup
stop on shutdown
expect fork
setuid peerflix-user
env HOME="/home/peerflix-user"

exec forever start -a -l peerflix.log /usr/local/bin/peerflix-server

pre-stop exec forever stop /usr/local/bin/peerflix-server

The init script runs under peerflix-user user and sets up $HOME variable.

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

No branches or pull requests

2 participants