From Aha2Y, 10 Years ago, written in Python.
Embed
  1. x = "bot.py"
  2. pid = os.getpid() + 2
  3.  
  4. if __name__ == "__main__":
  5.    print("Starting AhaServ - Pid: %s" % pid)
  6.    if os.fork()==0:
  7.            os.setsid()
  8.            sys.stdout=open("/dev/null", 'w')
  9.            sys.stdin=open("/dev/null", 'r')
  10.            ret = subprocess.call([sys.executable, x])
  11.            sys.exit(2)