| #!/usr/bin/python |
| |
| import os, os.path, sys |
| |
| dir = os.path.abspath(os.path.dirname(sys.argv[0])) |
| monitor_queue = os.path.join(dir, 'monitor_queue') |
| |
| if len(sys.argv) < 2: |
| print "Usage: start_all_queues <top_level_dir>" |
| sys.exit(1) |
| |
| os.system("killall monitor_queue") |
| |
| top_dir = os.path.abspath(sys.argv[1]) |
| queue_dir = os.path.join(top_dir, 'queue') |
| results_dir = os.path.join(top_dir, 'results') |
| |
| for machine in os.listdir(queue_dir): |
| queue = os.path.join(queue_dir, machine) |
| if not os.path.isdir(queue): |
| continue |
| |
| if not os.path.exists(results_dir): |
| print "No results directory: %s" % results_dir |
| sys.exit(1) |
| |
| console_path = "/usr/local/conmux/etc/%s.cf" % machine |
| if os.path.exists(console_path): |
| console = machine |
| else: |
| console = '' |
| |
| cmd = ' '.join([monitor_queue, queue, results_dir, console]) |
| print cmd |
| os.system("nohup %s > %s/.log 2>&1 &" % (cmd,queue)) |