I’m tryin to get auto-suspend operational, but it just doesn’t work. Set it corectly in power manager, enabled the lines in sleep.conf, but it seems that it cannot work, cause i’m not usin systemD.
With ‘systemctl suspend’, i get: ‘System has not been booted with systemd as init system (PID 1). Can’t operate. Failed to connect to bus: Host is down’.
You simply do not have permissions to write into the directory. Change location eg. to your home directory and try again. cd ENTER will get you to your home.
Nops, that’s just what i’m tryin to achieve. And i’m askin if the script you provided could do that, or if it requires a specific triger in order to suspend the computer. The wich i could do by simply clickin the suspend buton in the log out.
#!/bin/bash
# Function to convert minutes to milliseconds
convert_to_milliseconds() {
local minutes=$1
echo $((minutes * 60000))
}
# Set the number of minutes. System will suspend after:
MINUTES=5
# Convert to milliseconds
IDLE_TIME=$(convert_to_milliseconds "$MINUTES")
while true; do
idle=$(xprintidle)
if [ "$idle" -gt "$IDLE_TIME" ]; then
pm-suspend
fi
sleep 60 # Check every minute
done
Make sure that you have xprintidle package installed before you run the script:
I think the best approach is to find out why native tools do not work for you. What Linux Distro and desktop are you using? After that you can decide on the strategy as there are many solutions. You could also use cron etc.