Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Perl and Windows Idle?

by kgnickl (Novice)
on Jun 03, 2011 at 15:21 UTC ( [id://908008]=perlquestion: print w/replies, xml ) Need Help??

kgnickl has asked for the wisdom of the Perl Monks concerning the following question:

So I have a script that runs and can take 1-8 hours depending on the size of data. The script is run through a Windows 2008 server where the user authenticates through citrix. The citrix server is set to log the user off if idle after 2 hours. If I run a long script lets say when I leave, I lock my machine, and when I get in the next morning machine logged off about 2 hours later killing the script in the process. Does anyone know any methods in perl to get the current logged in users idle time, then if the idle time is x or greater do something to make the machine not idle? I basically want something that will not affect the user if they are active in the machine working, but if they are idle I want to add code to long running scripts to keep the machine active until the script finishes and is closed.

Replies are listed 'Best First'.
Re: Perl and Windows Idle?
by davido (Cardinal) on Jun 03, 2011 at 15:37 UTC

    I had to work from a Citrix client for a few years, and didn't much care for it. Through a T1 connection services such as browsing a remote filesystem were painfully slow. But that doesn't have anything to do with your question; I'm just sympathizing. :)

    On the Citrix server, user account properties, session tab, you can ask the administrator to disable timeout by setting idle timeout to never.

    There are also strategies you can use from the client side, which are documented in citrix support article #CTX105717. Google is a wonderful resource: keeping a citrix logon alive.

    If those don't work you could always use Windows scheduler to fire up a Perl script that 'tickles' Citrix through the Windows API every hour or so. I'm envisioning a script that gives the impression of Windows user starting up and stopping again some application that involves hitting the Citrix server.


    Dave

Re: Perl and Windows Idle?
by sundialsvc4 (Abbot) on Jun 03, 2011 at 16:31 UTC

    Can you launch the work as a “scheduled task” within Windows?   Or can you get and install a true batch-job monitor on that Windows box?   What this is going to come down to is, you need to tell Windows to run that program, as a particular user but not connected to a user session, so that the user can start the job and then disconnect, then log back on the next morning and check the job’s completion status.   “Citrix or not” would then drop right out of the picture:   you would now approach the task of “getting this work done” in the same way, whether you are physically sitting in front of the box or not.

    If you are doing work that requires (up to) 8 hours to run, I think you need a batch job monitor regardless.

Re: Perl and Windows Idle?
by patcat88 (Deacon) on Jun 03, 2011 at 19:38 UTC
    You can use AutoHotKey, but its not Perl and is a psuedo-basic programing language. Or use Win32::GUI to send spoofed cursor move messages on the windows message loop to Perl/Citrix/App on the client machine that times out. Use Winspector (a lil hard to find, authors website is dead) to sniff/log the Message Queue of an app. I use it.
Re: Perl and Windows Idle?
by Anonymous Monk on Jun 03, 2011 at 19:01 UTC
    Do they have "screen" for windows?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://908008]
Approved by Corion
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-18 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found