Perform reboot automatically when Linode kernel update is available

Is there any way to Perform reboot automatically when Linode kernel update is available.

I am using Linode Kernel (Latest 64 bit (4.14.12-x86_64-linode92)) on Ubuntu 16.04 LTS

6 Replies

There's a kernels endpoint in the new API..you could probably script something to reboot your Linode when "Latest" changes: https://developers.linode.com/v4/refere … de#kernels">https://developers.linode.com/v4/reference/linode#kernels

In terms of some option you can select in the Linode Manager though..no, that doesn't exist.

I have some ideas but i need help in the right direction. Please check and test given cronjob / crontab codes whether it is working or not

curl -s https://api.linode.com/v4/linode/kernels/linode/latest-64bit | grep "Latest 64 bit *$(uname -r)" > /dev/null
if [ $? -eq 1 ] ; then
systemctl reboot
fi

please help me

It is not a "good idea" to blindly reboot a server for a kernel update. This is why it is strongly advised to schedule a specific time and do the reboot manually.

It is possible that an automated reboot happens at the same time as something critical, like a backup procedure or payment function. It depends heavily on what the server is doing.

@IfThenElse:

It is not a "good idea" to blindly reboot a server for a kernel update. This is why it is strongly advised to schedule a specific time and do the reboot manually.

It is possible that an automated reboot happens at the same time as something critical, like a backup procedure or payment function. It depends heavily on what the server is doing.

I am using a simple WordPress blog. Where reboot is not matter but security patches are important to me. Your advise is good for those who has high availability system and If you have advice how to implement above setting you are always welcome.

In CentOS, you can install the package yum-utils, which provides the command needs-restarting, then you can just execute the following (via cron, etc):

needs-restarting -r || reboot

This method is the preferred way, because it also covers important packages like the kernel, glibc and others. It can be automated in all sorts of ways.

@IfThenElse:

In CentOS, you can install the package yum-utils, which provides the command needs-restarting, then you can just execute the following (via cron, etc):

needs-restarting -r || reboot

This method is the preferred way, because it also covers important packages like the kernel, glibc and others. It can be automated in all sorts of ways.

Sorry, I don't use CentOS I use only Ubuntu please provide preferred solution related to Ubuntu 16.04 LTS

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