| #!/usr/bin/python2 |
| import sys,os |
| |
| autodir = None |
| autotest_conf = os.path.realpath('/etc/autotest.conf') |
| |
| if os.path.isfile(autotest_conf): |
| autodir = os.path.dirname(autotest_conf) |
| if not autodir: |
| for path in ['/usr/local/autotest', '/home/autotest']: |
| if os.path.exists(os.path.join(path, 'bin/autotest')): |
| autodir = path |
| |
| if not autodir: |
| print "Autotest home dir NOT FOUND" |
| sys.exit() |
| |
| autotest = os.path.join(autodir, 'bin/autotest') |
| control = os.path.join(autodir, 'control') |
| state = os.path.join(autodir, 'control.state') |
| |
| if len(sys.argv) == 1 or sys.argv[1] == 'start': |
| if os.path.exists(state): |
| print "Restarting partially completed autotest job" |
| os.system(autotest + ' --continue ' + control) |
| else: |
| print "No autotest jobs outstanding" |