0

I know how to hibernate just at the time using:

sudo pm-hibernate

What I need is hibernate in the next 60 minutes.
For example, when you wanna shut down in 60 minutes you type:

sudo shutdown -h 60

How can I make the same action but for hibernation?

1 Answer 1

2

You may use sleep command. It accepts postfix m to numbers, which stands for minutes. I.e. you can execute

sleep 60m && someCommand

Now, here's a little problem that sudo after a time limit requires to enter the password again, and if you'd execute sudo sleep 60m && sudo somecommand, the someCommand wouldn't do in time. To workaround it, execute everything in a separate shell with elevated rights using the -c option of sh. I.e. the command would be:

sudo sh -c "sleep 60m && pm-hibernate"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .