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

Can json-server running at background? #221

Closed
vanney9 opened this issue Jan 12, 2016 · 9 comments
Closed

Can json-server running at background? #221

vanney9 opened this issue Jan 12, 2016 · 9 comments

Comments

@vanney9
Copy link

vanney9 commented Jan 12, 2016

I install json-server on Linux. And it works well when i type "json-server --watch db.json". But when I try to put json-server at background using commend "nohup json-server --watch db.json", error happened.
And here is the log file(nohup.out):
2016-01-12 5 05 20

@typicode
Copy link
Owner

Hmm can't seem to reproduce on OS X
I guess it's after you edit db.json that you have this error?

@typicode
Copy link
Owner

Reproducing on Linux...

@vanney9
Copy link
Author

vanney9 commented Jan 14, 2016

yeah, I run this commend "nohup json-server --watch db.json" on Linux, not OS X. Have you found out the problem?

@typicode
Copy link
Owner

No sorry, didn't have the time to check that. So if anyone has an idea about it or want to help with this.

BTW I'm working on a tool for managing background servers, if you want to give a try https://github.com/typicode/hotel (it's not as simple as a nohup though).

@adamlsmith
Copy link

I had experienced a similar problem, with a different version and hence line number:

events.js:72
throw er; // Unhandled 'error' event
^
Error: connect EACCES
at errnoException (net.js:901:11)
at Object.afterConnect as oncomplete

I am running:

Linux ip-172-30-2-68 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

nodejs v0.10.25
json-server 0.8.10

@gaelmotte
Copy link

Bad file descriptor feels like json-server isn't really pleased nohup leads to no stdin.

found workarround, give it something to read :
echo "\n" | nohup json-server db.json > logs.log &

@a-sane
Copy link

a-sane commented Nov 28, 2016

I had same problem and seems i found workaround:
nohup json-server db.json </dev/null &

Also in my case json-server with nohup terminated after some time for an unknown reason, so if you'll have same issue you can try https://github.com/foreverjs/forever :

forever start /usr/local/bin/json-server /path/to/db.json

@typicode
Copy link
Owner

Hi,

In the next version of JSON Server (v0.9.2), the error will be caught:
c527e1e#diff-9676bb4e4701737e2a8e762cd177b0f6R165

It will be possible then to use nohup without workarounds :)

@typicode
Copy link
Owner

v0.9.2 with fix for nohup has just been published

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

5 participants