Announcement

Collapse
No announcement yet.

Scripting challenge: How to detect desktop activity?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scripting challenge: How to detect desktop activity?

    OK bash scripters: I am working on a networked system that controls, among other things, 10 HD projectors. These suckers produce heat and the bulbs are expensive and have to be replaced every 2000 hrs - a little more often than once a year - at a cost of $500 per bulb.

    I request over-and-over again from the users to turn off the projectors when not in use for more than 5 minutes. In practice, they remember about 30% of the time.

    I already have a script that turns the projectors off and on at will, but I want the system to be able to detect 5 minutes of keyboard/mouse inactivity and turn off the monitors automatically. Of course, this would have to be as resource friendly as possible.

    Any ideas?

    Please Read Me

    #2
    I should mention this is an old RHEL4/Gnome system. xidle, xprintidle, and others are not available.

    Please Read Me

    Comment


      #3
      Might provide some insight: http://superuser.com/questions/63835...-for-5-minutes
      Using Kubuntu Linux since March 23, 2007
      "It is a capital mistake to theorize before one has data." - Sherlock Holmes

      Comment


        #4
        Sounds like you have a human problem, not a technical one. Perhaps you should charge the users for each bulb. Or randomly fire and replace a user every time a bulb blows. But wait -- then you'd have to restart your training on each new person. That might be expensive. To offset the cost, require each new hire to bring his/her own bulb.

        Comment


          #5
          Originally posted by SteveRiley View Post
          Sounds like you have a human problem, not a technical one. Perhaps you should charge the users for each bulb. Or randomly fire and replace a user every time a bulb blows. But wait -- then you'd have to restart your training on each new person. That might be expensive. To offset the cost, require each new hire to bring his/her own bulb.
          Yeah, tried that. When I mentioned to the boss of the team in question that his people were still leaving the projectors on, he rolled his eyes and headed for the door. I stopped him before he blew his cork and offered the above idea as an alternate to thrashing his workers. LOL

          Best idea I've come up with so far is a count down timer that resets when the mouse is used. Most of the operations require mouse input so I really don't need to poll both devices. I want to avoid adding too much additional load to the system, so a very low priority operation will be required.

          Unfortunately, the computers that run the projectors are windows machines. The projectors themselves are slightly more complicated than a simple computer monitor and require a string of input to turn off and on. The script on the file server handles that OK, but the windows machines screen saver won't turn them off.

          Of course, the real reason I'm behind this is because I want to prove it can be done! Unfortunately, these machines are isolated from the world and I can't install any new software. xprintidle is not installed on the system so Paul's website reference won't work. I thought of xte or xdotool - neither installed here.

          What does the screensaver use to detect activity?

          Please Read Me

          Comment


            #6
            Oh, how about this:

            cronjob set to run script every 5 minutes

            script looks at output of who -u -H and compares idle minutes to 5, if greater, turn off monitors, if lesser, exit.

            EDIT: Nah, that doesn't work. who doesn't detect X input, only terminal

            Please Read Me

            Comment


              #7
              xinput ?

              maby start a test loop and pipe it to something that watches for inactivity ??

              VINNY
              i7 4core HT 8MB L3 2.9GHz
              16GB RAM
              Nvidia GTX 860M 4GB RAM 1152 cuda cores

              Comment


                #8
                Originally posted by oshunluvr View Post
                Oh, how about this:

                cronjob set to run script every 5 minutes

                script looks at output of who -u -H and compares idle minutes to 5, if greater, turn off monitors, if lesser, exit.

                EDIT: Nah, that doesn't work. who doesn't detect X input, only terminal
                Take a look at http://stackoverflow.com/questions/2...212854#2212854
                Using Kubuntu Linux since March 23, 2007
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Originally posted by oshunluvr View Post
                  I should mention this is an old RHEL4/Gnome system. xidle, xprintidle, and others are not available.
                  RHEL4 might be old enough to still have xscreensaver... then you'd script using xscreensaver-command -watch; see http://www.jwz.org/xscreensaver/man3.html

                  Regards, John Little
                  Last edited by jlittle; Oct 26, 2013, 01:32 AM.
                  Regards, John Little

                  Comment

                  Working...
                  X