comparison server/utils.py @ 65:b09c164debf6

cheap_daemon()
author Matt Johnston <matt@ucc.asn.au>
date Tue, 26 Jun 2012 21:36:54 +0800
parents 340a14fcbaeb
children c5ad12670cae
comparison
equal deleted inserted replaced
64:fcec23170f03 65:b09c164debf6
95 crc >>= 1 95 crc >>= 1
96 ch >>= 1 96 ch >>= 1
97 uc += 1 97 uc += 1
98 i += 1 98 i += 1
99 return crc 99 return crc
100
101 def cheap_daemon():
102 try:
103 pid = os.fork()
104 if pid > 0:
105 sys.exit(0)
106 except OSError, e:
107 print>>sys.stderr, "Bad fork()"
108 sys.exit(1)
109
110 os.setsid()
111
112 try:
113 pid = os.fork()
114 if pid > 0:
115 sys.exit(0)
116 except OSError, e:
117 print>>sys.stderr, "Bad fork()"
118 sys.exit(1)
119
120