How to automatically check for a new kernel
#!/bin/bash
curl -s "https://api.linode.com/?api_key=TODOyourlongLinodeAPIKeyhere&api_action=avail.kernels&isXen=1" | jq '.DATA' | grep "Latest.*$(uname -r)" > /dev/null
if [ $? -eq 1 ]; then
touch /var/run/reboot-required
echo "New Linode Kernel is available - Reboot Required" | mail -s "New Linode Kernel is available" TODO@email
fi
3 Replies
Either way works, all depends what kind of parsing you want to do.
- Les
> Rather than putting an API key on the Linode, you could also use the RSS feed:
https://www.linode.com/rss/kernels.xml Either way works, all depends what kind of parsing you want to do.
- Les
And here's a bash script that uses the rss feed
#!/bin/bash
curl -s https://www.linode.com/rss/kernels.xml | grep "Latest.*$(uname -r)" > /dev/null
if [ $? -eq 1 ]
then
echo -n 'Not using latest Linode kernel'
fi