autobuild: create an autobuild.pid file
authorAndrew Tridgell <tridge@samba.org>
Tue, 19 Oct 2010 22:44:03 +0000 (09:44 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 19 Oct 2010 23:36:05 +0000 (23:36 +0000)
this will allow us to avoid an error email when you resubmit and there
is an existing autobuild.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Tue Oct 19 23:36:05 UTC 2010 on sn-devel-104

script/autobuild.py

index cb3e9595bde3a0e32f8d6634116041ba305f1514..3fae59f25520b496386d0a1cfee0886600d28e38 100755 (executable)
@@ -273,6 +273,13 @@ def daemonize(logfile):
     os.dup2(0, 1)
     os.dup2(0, 2)
 
+def write_pidfile(fname):
+    '''write a pid file, cleanup on exit'''
+    f = open(fname, mode='w')
+    f.write("%u\n" % os.getpid())
+    f.close()
+    cleanup_list.append(fname)
+
 
 def rebase_tree(url):
     print("Rebasing on %s" % url)
@@ -435,6 +442,8 @@ if options.daemon:
     print "Forking into the background, writing progress to %s" % logfile
     daemonize(logfile)
 
+write_pidfile(gitroot + "/autobuild.pid")
+
 while True:
     try:
         run_cmd("rm -rf %s" % test_master)