#!/usr/bin/env python2.2 import signal, sys, os, string, urllib def handler(signum, frame): print 'Signal handler called with signal', signum def bye(signum, frame): print 'Signal handler called with signal', signum sys.exit() print "start job" #ignore usual stuff signal.signal(signal.SIGXCPU, signal.SIG_IGN) signal.signal(signal.SIGTERM, bye) signal.signal(signal.SIGQUIT, signal.SIG_IGN) signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGABRT, signal.SIG_IGN) signal.signal(signal.SIGUSR1, signal.SIG_IGN) signal.signal(signal.SIGPOLL, signal.SIG_IGN) signal.signal(signal.SIGUSR2, handler) project = "ORCA" provers = "ORCA_8_0_1" for x in os.popen("scram listcompact " +project).readlines() : if (x.find(provers)!=-1): orcapath = x[x.find('/'):-1] orcapath = orcapath.strip() print 'installing ORCA tutorial in', provers, 'from', orcapath sys.stdout.flush() os.system("scram project "+project+" " +provers) os.chdir(provers) os.chdir("src") os.system("mkdir Workspace;") os.chdir("Workspace") c = urllib.urlretrieve("http://home.cern.ch/neumeist/ORCATutorial/MuonTutorial_Apr_2004.tgz", 'Tutorial.tgz') os.system("tar -zxf "+'Tutorial.tgz') os.system("rm -f "+'Tutorial.tgz') os.system("scram b;") for x in os.popen("scram runtime -csh").readlines(): [crap,e,v] = x.split(' ',2) os.environ[e] = v[1:-3] sys.stdout.flush() os.system('Tutorial -c orcarc | tee output') print "very good"