0

I am trying to restart my Centos 6.7 system using the command line:

init 6

But I need it stay down N number of seconds before starting back up again. I have been searching with Google, but I cannot by a variant of the init command that will do this.

  • Does your system have a remote management interface or IPMI? – jayhendren Dec 21 '16 at 20:10
  • 1
    Make sure you're using the right terminology. "Off" isn't the same as "suspended" (or hibernating). In one case, rtcwake from icarus' answer will work. In the other, you need IPMI or at least functioning WOL and another device to issue the wakeup. – alzee Dec 21 '16 at 20:11
  • Off is the state i need, not "suspended" or "hibernating". cmd ":rtcwake -m off -s 30" Help me a lot! – Ricardo_arg Dec 21 '16 at 20:41
  • @user3137702 As the referenced manual page shows, -m off is not officially supported but usually works. Do you have an actual example where it doesn't? I could be persuaded that a system with a flat RTC battery or a chomebook with a flat main battery (as they typically don't have a separate RTC battery) might not work. – icarus Dec 22 '16 at 2:53
1

As you are on Debian, you want the rtcwake utility.Manual page

Not good for very short sleeps (say less than 10 seconds) as it may take more time to put the system to sleep than that.

The basic idea is that you program the RealTimeClock chip as a wake source for n seconds in the future and then suspend, either to ram or disk, or even switch the system off..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.