Poweroff after inactivity / a script?

Forum Forums General Software Poweroff after inactivity / a script?

  • This topic has 20 replies, 5 voices, and was last updated Oct 18-1:29 pm by augusteBurin.
Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #90728
    Member
    augusteBurin
      Helpful
      Up
      0
      ::

      Hello, back to business, I take the script up again, and I see it will maybe need some adjustments in order to determine the idle limit. having things like firefox and libreoffice writer running it feels to busy. Any hints how to trig this? Or maybe I didn’t wait long enough for a relevant average measure?

      More to come: There is also a problem with the poweroff command as it appears here: yad –on-top –text “SHUT DOWN” –timeout 4 –timeout-indicator=top –button “Cancel” || poweroff
      That is: it doesn’t poweroff the machine, though doing the poweroff command in a shell does it.

      Thanks in advance
      ab

      • This reply was modified 6 months, 4 weeks ago by augusteBurin.
      • This reply was modified 6 months, 4 weeks ago by augusteBurin.
      • This reply was modified 6 months, 3 weeks ago by augusteBurin.
      #90783
      Member
      Vincent17
        Helpful
        Up
        1
        ::

        Hello Auguste,
        Sorry, “poweroff needs to be superuser”. I forgot I had changed that in my system. Try yad –on-top –text “SHUT DOWN” –timeout 4 –timeout-indicator=top –button “Cancel” || sudo poweroff

        Regarding cpu load, you could run htop in a terminal while doing your normal things and watch the Load average item (2nd row, 2nd column, 1st number) to get an idea of an appropriate number to use in the script.

        • This reply was modified 6 months, 3 weeks ago by Vincent17.
        #90797
        Member
        augusteBurin
          Helpful
          Up
          0
          ::

          You’re a flower, as we say in french!

          [almost SOLVED]

          • This reply was modified 6 months, 3 weeks ago by augusteBurin.
          • This reply was modified 6 months, 3 weeks ago by augusteBurin.
          • This reply was modified 6 months, 3 weeks ago by augusteBurin.
          #90838
          Member
          augusteBurin
            Helpful
            Up
            0
            ::

            This script works quite well, it checks fine the load average but it does not consider mouse or keyboard activity, not at all. Sorry to say that, Vincent17 (I have installed xprintidle)
            Workaround?

            #90848
            Member
            Vincent17
              Helpful
              Up
              1
              ::

              it does not consider mouse or keyboard activity, not at all.

              Do you mean that the script powers off the computer even if you are moving the mouse or typing? To test xprintidle, you could try in a terminal sleep 5; xprintidle [ENTER]
              If you don’t touch the computer for 5 seconds, it should print out a number close to 5000. If you use mouse or keyboard during the 5 seconds, it should print out a smaller number. xprintidle has always worked for me, but if for some reason it does not on your computer, then the script is useless for you. 🙁 I don’t know a workaround.

              EDIT: This ubuntu user found that a certain game resets the variable used by xprintidle every 30 seconds.

              • This reply was modified 6 months, 3 weeks ago by Vincent17.
              #90908
              Member
              augusteBurin
                Helpful
                Up
                0
                ::

                Hello
                sleep 5; xprintidle
                That works fine: idle = 4959
                Mouseactivity : less than 3000

                Trying the script again today seems like working fine. I have no idea why yesterday it didn’t.

                Well: SOLVED
                Thanks a lot!
                (And I dont game)

              Viewing 6 posts - 16 through 21 (of 21 total)
              • You must be logged in to reply to this topic.