- This topic has 20 replies, 5 voices, and was last updated Oct 18-1:29 pm by augusteBurin.
-
AuthorPosts
-
October 5, 2022 at 7:51 pm #90234Member
augusteBurin
The suspend mode does not work on my old Dell740. I hope to find a way to make the pc power off after, let’s say 30 minutes doing nothing. Any ideas, a script maybe?
Thanks for all help.
Augusto on Antix21 iceWM- This topic was modified 7 months ago by augusteBurin.
October 6, 2022 at 10:31 am #90286Member
sybok
::1) How do you specify *doing nothing* (in terms of user input, internet activity, HDD/SDD activity, some program [not-]running)?
E.g. what if a download/file-transfer is running (download using browser, curl/wget or via SSH) or an audio/visual file is being played.
Does this count or not?2) Suspending not working:
What does not work? I.e. what do you do, what do you expect and what do you get?Sometimes, I search for an issue using keywords describing the issue and adding ‘Debian’ or ‘Ubuntu’ since antiX, similarly to *buntu, is Debian based.
Of course, not all the tips are applicable to antiX and, as always, to be used with great care.I got e.g. the following link
https://askubuntu.com/questions/1117479/ubuntu-18-04-dell-xps-13-9350-suspend-issues-when-lid-closed
‘pm-utils’ and ‘lid’ may be packages to check for.3) Laptop battery usage may benefit from packages such as ‘tlp’ and ‘laptop-mode-tools’.
Using one of them may have its downsides, I think the latter used to turn off some not used HW ports/”devices” causing wi-fi issues.PS: Could you please add a link to the French version (where you mention a script)?
October 6, 2022 at 4:19 pm #90295MemberVincent17
::Hello,
Maybe xprintidle would work. It returns milliseconds since the last mouse or keyboard activity. For example, I run this script at startup.while true; do sleep 120 # don't shut down if cpu or sound active awk '{if ($1>.5) exit 1}' /proc/loadavg || continue grep -qr "RUNNING" /proc/asound/card* && continue # don't shut down if less than 15 min since mouse/keyboard activity [[ $(xprintidle) -lt 900000 ]] && continue poweroff doneHope this helps.
- This reply was modified 6 months, 4 weeks ago by Vincent17.
- This reply was modified 6 months, 4 weeks ago by Vincent17. Reason: correction
October 7, 2022 at 10:10 am #90337Member
augusteBurin
::Hello,
By doing nothing I would be happy with just no keyboard or mouse activity, but of course a download check would be nice, but I guess I could manage that by stopping the script in the rare case of long downloads on this desktop, which is essentially for office use.Suspend through Antix menu ‘works’, but not the wake up , so it doesn’t work.
In the french forum, there is discussion about things working on other debian based distros, but not on Antix.
You can see her: https://www.antixforum.com/forums/topic/eteindre-lordi-apres-inactivite/so long!
ABOctober 7, 2022 at 10:34 am #90341Member
augusteBurin
::Hello
Sorry not to know how to use correctly the forum features, but this is answer to @vincent17 post
I try :#! /bin/bash while true; do sleep 120 # don't shut down if cpu or sound active awk '{if ($1>.5) exit 1}' /proc/loadavg || continue grep -qr "RUNNING" /proc/asound/card* && continue # don't shut down if less than 1 min since mouse/keyboard activity [[ $(xprintidle) -lt 60000 ]] && continue echo "poweroff test" #poweroff doneI call it powrf.sh and do a chmod +x powrf.sh
but when I test it in a terminal it outputs “ligne 8: xprintidle : commande introuvable” (no such command) repeated until I stop it.I am on Antix21 using iceWM
Thanks for echoes.
ABOctober 7, 2022 at 12:03 pm #90347Member
sybok
October 7, 2022 at 12:31 pm #90348Member
augusteBurin
::that works!
Now it would be perfect if it was a warning delay before the poweroff.thanks.
abOctober 7, 2022 at 12:44 pm #90349Member
sybok
::Look up the forum for implementing emergency suspend/shutdown; the code/script there contains similar functionality.
https://www.antixforum.com/forums/topic/how-do-i-implement-an-automated-emergency-suspend-or-shutdown/October 7, 2022 at 4:43 pm #90356MemberVincent17
::a download check would be nice, but I guess I could manage that by stopping the script
I’ve never figured out a good way to do that, but in the script below, if you
do touch /tmp/no-suspend then it won’t poweroff; no need to stop the script. Do rm /tmp/no-suspend to allow poweroff again.a warning delay before the poweroff
Also added below
#! /bin/bash while true; do sleep 120 # don't shut down if less than 15 min since mouse/keyboard activity [[ $(xprintidle) -lt 900000 ]] && continue # don't shut down if /tmp/no-suspend exists [[ -f /tmp/no-suspend ]] && continue # don't shut down if cpu or sound active awk '{if ($1>.5) exit 1}' /proc/loadavg || continue grep -qr "RUNNING" /proc/asound/card* && continue yad --on-top --text "SHUT DOWN" --timeout 4 --timeout-indicator=top --button "Cancel" || poweroff done- This reply was modified 6 months, 4 weeks ago by Vincent17.
- This reply was modified 6 months, 4 weeks ago by Vincent17. Reason: for clarity
- This reply was modified 6 months, 4 weeks ago by Vincent17.
October 7, 2022 at 5:29 pm #90359ModeratorBobC
October 7, 2022 at 6:31 pm #90362Member
blur13
::Haha you better have quick reactions. And pray you’re not in the kitchen getting a glass of water.
October 8, 2022 at 9:48 am #90376Member
augusteBurin
::This is great!
But please: why sleep? and why 120 ?
And timeout 4, is that milliseconds, minutes, hours, days?AB
- This reply was modified 6 months, 3 weeks ago by augusteBurin.
October 8, 2022 at 12:23 pm #90378Member
blur13
October 8, 2022 at 2:51 pm #90382MemberVincent17
::More details: As written, the script checks computer activity every 120 seconds; the keyboard/mouse idle time to trigger shutdown is 900000 milliseconds; shutdown is prevented if 1-minute cpu load average is over 0.5; the warning delay before poweroff is [only!] 4 seconds. Of course, all of these can be changed to meet your needs.
I’m glad you’ve found it useful.October 9, 2022 at 5:56 am #90410Member
sybok
-
AuthorPosts
- You must be logged in to reply to this topic.