Scheduling a reboot

When my Linode needs a reboot due to, say, a kernel upgrade, I'd like to be able to schedule that to happen at a convenient time. I think I should be able to do this with the "at" command like so:

echo "reboot" | at 06:00

However, whenever I use "reboot" or "shutdown -r 0", my Linode just shuts down, doesn't reboot, and I have to boot it manually from the Linode manager. Is this normal? How can I get my Linode to boot back up automatically?

I'm running Ubuntu 10.10

10 Replies

did you enable Lassie in your Linode's settings? it will automatically reboot your server if it ever powers off.

Aha, thanks, that's exactly what I needed. I never noticed Lassie before.

Also, you can call shutdown with a time:

shutdown -r 06:00

or:

shutdown -r +60 # to do it 60 minutes from now

And an optional message:

shutdown -r 06:00 "Reticulating splines"

If you have folks that use the shell, it will give them reminders that it is going down, and it will also prevent logins during the final 5 minutes.

(Lassie still applies, however :-)

Also, you can use ssh and Lish to send a reboot command right to the host. Just set up ssh keys to Lish, and vollia!

http://library.linode.com/eUmqlq explains more

I used to have such fun reticulating splines… The llamas were an obstacle, though, I must admit.

Why do you need to reboot nightly? Are you sure you need to reboot? You may be doing something that you think needs a reboot but which can actually be done without reboots.

@Guspaz:

Why do you need to reboot nightly? Are you sure you need to reboot? You may be doing something that you think needs a reboot but which can actually be done without reboots.
@plasticboy:

When my Linode needs a reboot due to, say, a kernel upgrade, I'd like to be able to schedule that to happen at a convenient time.

/me facepalms

Don't know how I missed that. There's also ksplice, which will get you kernel updates without rebooting. There's another thread somewhere around here about a guy who set it up on his linode. It does mean switching away from Linode's kernel, though.

Why doesn't the server come back up after a reboot? Is there something wrong with the kernel that it's not sending the right signal to the host?

From what I've seen, "kernel shutdown" always powers down your Linode. No matter if you use shutdown -r/-h/-P (reboot/halt/poweroff), it ends up in a powerdown.

If you want a reboot, you can use the "reboot" command in Lish, which signals your init to do a graceful reboot just like the in-system "reboot" command does and restarts the Linode afterwards, or make sure you have Lassie enabled, and accept a bit longer delay before the system coming back up.

Lassie re-starts a Linode that has been powered off "from the inside" (as opposed to LISH or the manager interface), but it does it after a few minutes of delay.

PS. I heard you could use Linode API to issue a reboot command in an unattended way, but I don't know the details.

Replacing $LINODEAPIKEY with your API key and $LINODEID with your Linode's numeric ID (LINODEID="12345"):

curl https://api.linode.com/?api_key=$LINODE … $LINODE_ID">https://api.linode.com/?apikey=$LINODEAPIKEY\&apiaction=linode.reboot\&linodeid=$LINODE_ID

I haven't tested this.

EDIT: or, of course, you can "ssh linode${LINODEID}@${LINODEHOST}.linode.com reboot", but that requires knowledge of the Linode host server and pre-negotiated credentials.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct