From 39932f21dabbd96b6a1e7165d9289069cac87a3e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 20 Oct 2010 09:44:03 +1100 Subject: [PATCH] autobuild: create an autobuild.pid file this will allow us to avoid an error email when you resubmit and there is an existing autobuild. Pair-Programmed-With: Andrew Bartlett Autobuild-User: Andrew Tridgell Autobuild-Date: Tue Oct 19 23:36:05 UTC 2010 on sn-devel-104 --- script/autobuild.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/autobuild.py b/script/autobuild.py index cb3e9595bde..3fae59f2552 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -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) -- 2.34.1