00001
00002
00003
00004 import os, string, sys, math, time
00005 if(len(sys.argv)<2):
00006 print("example: separate_jobs.py 10")
00007 sys.exit()
00008 else:
00009 num = int(sys.argv[1])
00010
00011 count = 0
00012 tag = 0
00013 jobfile = open("job.txt", "r")
00014 for line in jobfile:
00015 count += 1
00016 if count == 1:
00017 tag += 1
00018 subjob = open("subjob_" + str(tag) + ".sh", "w")
00019 subjob.write(line)
00020 if count == num:
00021 count = 0
00022 subjob.close()
00023 os.system("chmod u+x subjob_" + str(tag) + ".sh")
00024 subjob.close()
00025 os.system("chmod u+x subjob_" + str(tag) + ".sh")