Mercurial > templog
comparison server/utils.py @ 371:7dec59b7eeef
cheap_daemon()
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 26 Jun 2012 21:36:54 +0800 |
parents | 20f7161399a8 |
children | c5ad12670cae |
comparison
equal
deleted
inserted
replaced
370:aaa94f90eaa1 | 371:7dec59b7eeef |
---|---|
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 |