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

Re: [Condor-users] Only run when logged of?



Dave STREET wrote:
  I came up with the following script

trComputer = "." ' " use "." for local computer Set objWMI = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colSessions = objWMI.ExecQuery _ ("Select * from Win32_LogonSession Where LogonType = 2") If colSessions.Count = 0 Then Wscript.Echo "FALSE"
Else
  WScript.Echo "True"
End If

So this echos TRUE is a user is Logged on and False is not. My questions is though when you say it must return TRUE or FALSE to the STARTD_CRON job I am assuming I would need to change the echo statements but I am not sure what to. Any ideas. Other wise this seems a perfect solution.

Hi Aaron (or is it Davey?) -

Awesome!

You'd want your above script to not just echo "True" or "False, but it should echo to stdout "UsersLoggedIn = True" or "UsersLoggedIn = False" if you configure things up as Ian suggested below.

Assuming you get it all working in short order, can I persuade you to contributing a HOWTO recipe for this? It would likely be of interest to other Condor users. We've been trying to collect such HOWTOs on the Condor wiki at
  https://condor-wiki.cs.wisc.edu/index.cgi/wiki?p=HowToAdminRecipes
see the above URL to get a feeling of what I am talking about. If you are interested, please just drop a note to condor-admin@xxxxxxxxxxx and we'll create an account for you on the wiki (anonymous users have read access, but an account is needed to create/edit content).

regards,
Todd



Cheers

Aaron

Date: Wed, 15 Sep 2010 10:31:10 -0400
From: ichesal@xxxxxxxxxxxxxxxxxx
To: condor-users@xxxxxxxxxxx
Subject: Re: [Condor-users] Only run when logged of?

On Wed, Sep 15, 2010 at 8:48 AM, Dave STREET <davey_street@xxxxxxxxxxx <mailto:davey_street@xxxxxxxxxxx>> wrote:

    I am sure this is easy and I know some people do it, but how can I
    make it so windows machines only accept jobs and run jobs while no
one is logged on, and remove jobs as soon as a user logs in?
    I can see how to set up for CPU and keyboard busy. But I want to
    have the logged on status of the machine control when jobs can and
cant run?

Aaron,

There isn't a built-in macro in Condor that indicates whether a user is logged in to a machine or not. But you could write something that can be called from a STARTD_CRON that returned True or False depending on whether users are logged in or not.

And then:

STARTD_CRON_JOBLIST = LOGINCHECKER
STARTD_CRON_LOGINCHECKER_PREFIX = LoginChecker
STARTD_CRON_LOGINCHECKER_EXECUTABLE = c:\condor\loginchecker.exe
STARTD_CRON_LOGINCHECKER_PERIOD = 1m
STARTD_CRON_LOGINCHECKER_MODE = Periodic
STARTD_CRON_LOGINCHECKER_RECONFIG = True

(That syntax is likely not 100% correct, I'm working from memory here on the cron syntax, but that should get you started)

The output from loginchecker.exe should be ClassAd attribute syntax. So:

UsersLoggedIn = (True|False)

That'll produce an attribute in your machine's ad called LoginCheckerUsersLoggedIn that you can reference in your START/SUSPEND/PREEMPT strings:

START = $(LoginCheckerUsersLoggedIn) =!= True

That should also keep START = False if the cron hasn't run and the attribute has never been set.

- Ian


Cycle Computing, LLC
The Leader in Open Compute Solutions for Clouds, Servers, and Desktops
Enterprise Condor Support and Management Tools

http://www.cyclecomputing.com
http://www.cyclecloud.com

_______________________________________________ Condor-users mailing list To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a subject: Unsubscribe You can also unsubscribe by visiting https://lists.cs.wisc.edu/mailman/listinfo/condor-users The archives can be found at: https://lists.cs.wisc.edu/archive/condor-users/


------------------------------------------------------------------------

_______________________________________________
Condor-users mailing list
To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/condor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/condor-users/


--
Todd Tannenbaum                       University of Wisconsin-Madison
Center for High Throughput Computing  Department of Computer Sciences
tannenba@xxxxxxxxxxx                  1210 W. Dayton St. Rm #4257
Phone: (608) 263-7132                 Madison, WI 53706-1685