[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Condor-users] running commands when jobs start and stop



Since Condor 7.2 isn't ready to put our computers to sleep yet, we are using sleepd. sleepd can be prevented from making a computer sleep by running the command 'sleepctl off'. I wrote a wrapper in bash for that and set HOOK_PREPARE_JOB to run it. I did the same thing for HOOK_JOB_EXIT to enable sleeping.

I noticed that HOOK_PREPARE_JOB gets run when condor starts up and when a job is about to run. This make our computers never sleep. Is there a better hook or a way to make this hook only run when a job is starting?

Since this hook gets the classad as stdin, I tried adding the following to my wrapper to prevent it from running when no job is about to run.

if ( [ ! -t 0 ] && ( cat - | grep -i mytype | grep -i job > /dev/null ))

This should only succeed if STDIN has a line like:
MyType = "Job"

Unfortunately, my test systems say that sleeping is disabled after condor is restarted.

Any suggestions?

Jeff