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

running in background #17

Open
chrispri opened this issue Apr 17, 2017 · 4 comments
Open

running in background #17

chrispri opened this issue Apr 17, 2017 · 4 comments

Comments

@chrispri
Copy link

I can´t run it in background.
If I do with nohup python relay.py "http://user:pwd" &@ip..." & I get "'nohup python relay.py -d "http:…' has stopped" and in nohup.out the following:
Traceback (most recent call last):
File "relay.py", line 82, in
while raw_input() != "quit":
IOError: [Errno 9] Bad file descriptor

@OliverF
Copy link
Owner

OliverF commented Apr 17, 2017

Thanks for the report. This makes sense because there is nothing to read from in background mode. I'll have to add something to detect if we're running in such a situation. In the meantime a fix would be to use screen or tmux.

@chrispri
Copy link
Author

screen is working great. thx for the workaround and of course for mjpeg-relay ;)

@aziraphale
Copy link

I'm trying to run this as a background service but nothing I try will keep it running for more than maybe 15 minutes at a time.

Running it as a systemd service results in systemd restarting it repeatedly until the restart limit is reached, then systemd says that it failed, with "Main process exited, code=exited, status=1". If I try simply running the Python script on the command line (within screen), it works fine for a while but eventually ends up exiting with no indication of why (following is with debug mode enabled):

Starting new HTTP connection (1): 90.x.x.x
send: 'GET /?action=stream HTTP/1.1\r\nHost: 90.x.x.x:8080\r\nConnection: keep-alive\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: python-requests/2.10.0\r\nAuthorization: Basic Og==\r\n\r\n'
reply: 'HTTP/1.0 200 OK\r\n'
header: Access-Control-Allow-Origin: *
header: Connection: close
header: Server: MJPG-Streamer/0.2
header: Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0
header: Pragma: no-cache
header: Expires: Mon, 3 Jan 2000 12:34:56 GMT
header: Content-Type: multipart/x-mixed-replace;boundary=boundarydonotcross
"GET /?action=stream HTTP/1.1" 200 None
Connected to stream source, boundary separator: --boundarydonotcross
Client left. Client count: 2

This is with mjpeg-relay connecting to a Raspberry Pi running mjpg-streamer, which I suspect will be the standard way for anyone to be getting a mjpeg stream from a Pi. I'll have both ZoneMinder and a Chrome browser connected as clients for mjpeg-relay, although the Chrome connection tends to be closed by the time that mjpeg-relay exits.

Any ideas? Thanks :)

@masterxq
Copy link

It needs stdin stream... Else it will crash...

#22 (comment)

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

4 participants