-
-
Save anonymous/e32db6a5bc86bb2918a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
zerofd = os.open('/dev/zero', os.O_RDONLY) | |
nullfd = os.open('/dev/null', os.O_WRONLY) | |
# Close the stdthings and reassociate them with a non terminal | |
os.dup2(zerofd, 0) | |
os.dup2(nullfd, 1) | |
os.dup2(nullfd, 2) | |
#/usr/local/bin/marconi-server | |
# Detach process context | |
try: | |
pid = os.fork() | |
if pid > 0: | |
os._exit(0) | |
except OSError, ex: | |
os._exit(1) | |
try: | |
pid = os.fork() | |
if pid > 0: | |
os._exit(0) | |
except OSError, ex: | |
os._exit(2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment