Fedora vehicle suspend
I am making use of Fedora 13 and also for closing down and also restarting instantly, we have the adhering to commands:
# shutdown -h/-r now
In a similar way, if I intend to make my system enter into suspend setting after at some time, what command should I make use of?
The pm-suspend
energy (which is had in the pm-utils plan and also most likely currently mounted on your equipment) is what is made use of to send your computer system right into suspend setting. Hence to suspend "now," you can run (as origin or making use of sudo) :
# pm-suspend
Unfortunately, pm - suspend does not take a time parameter regarding I recognize. Nonetheless, you can write a wrapper manuscript that took a time parameter. Conserve the manuscript someplace in your $PATH and also chmod+x it. Do not call it "suspend". A straightforward one might resemble this :
#!/bin/sh
#change this following line to wherever pm-suspend lives
suspend="/usr/sbin/pm-suspend"
#make sure we are root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if [ -z "$1" ]; then
echo "mysuspend: time in seconds expected"
exit 1;
elif [ "$1" = "now" ]; then
echo "Suspending now!"
wait="0"
else
#make sure we get a number.
echo "$1" | grep [a-zA-Z] > /dev/null
if [ $? -ne 0 ]; then
echo "Suspending in $1 seconds"
wait="$1"
else
echo "mysuspend: time in seconds expected"
exit 1
fi
fi
sleep "$wait"
$suspend
Warning : I have actually not examined this past "benefit me".
You might take into consideration transforming the suspend command to pm - suspend - crossbreed which will certainly additionally conserve a hibernation documents in instance you lack power while put on hold.
Various other energies that you might want or that can make your manuscript extra durable are pm - hibernate, pm - is - sustained.
The unix ideology is to have devices that execute one work, plus the covering to incorporate them. So we'll incorporate a suspend command with a do - something - later on command. I do not recognize what the typical command for putting on hold gets on Fedora (there are numerous drifting around) ; I'll make use of pm-suspend
which is the common command on Ubuntu.
To suspend after X secs : sleep X && pm-suspend
To suspend at an offered time : echo pm-suspend | at HH:MM