[Buildroot] [PATCH 2/4] autobuild: store PID to PID file
Yann E. MORIN
yann.morin.1998 at free.fr
Wed Nov 25 23:06:39 UTC 2015
Let the autobuild script store its own PID file, rather than retrieve it
from the init script.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
---
scripts/autobuild-run | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index db60f5c..397c770 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -65,6 +65,7 @@ defaults = {
'--submitter': 'N/A',
'--make-opts': '',
'--nice': 0,
+ '--pid-file': '/tmp/buildroot-autobuild.pid',
}
doc = """autobuild-run - run Buildroot autobuilder
@@ -92,6 +93,8 @@ Options:
--make-opts OPTSTRING string of extra options to pass to Buildroot
make, such as specific command wrappers
Empty by default.
+ --pid-file PATH path to a file where to store the PID
+ Defaults to %(--pid-file)s.
-c, --config CONFIG path to configuration file
Not set by default.
@@ -807,6 +810,10 @@ def main():
# load in defaults at lowest priority
args = merge(args, defaults)
+ # Save our PID very early, so we can be stopped
+ with open(args['--pid-file'], "w+") as pidf:
+ pidf.write("%d" % os.getpid())
+
# http_login/password could theoretically be allowed as empty, so check
# explicitly on None.
upload = (args['--http-login'] is not None) \
--
1.9.1
More information about the buildroot
mailing list