Skip to content

Instantly share code, notes, and snippets.

@szepeviktor
Last active July 16, 2018 03:24
Show Gist options
  • Save szepeviktor/cf6b60ac1b2515cb41c1 to your computer and use it in GitHub Desktop.
Save szepeviktor/cf6b60ac1b2515cb41c1 to your computer and use it in GitHub Desktop.
Automatic update for made-in-ovh OVH kernels
#!/bin/bash
#
# Automatic update for made-in-ovh OVH kernels.
#
# VERSION :0.2
# DATE :2015-02-10
# AUTHOR :Viktor Szépe <viktor@szepe.net>
# LICENSE :The MIT License (MIT)
# URL :https://github.com/szepeviktor/debian-server-tools
# BASH-VERSION :4.2+
# DOCUMENTATION :http://help.ovh.co.uk/KernelInstall
# RSS-FEED :http://www.ftp2rss.com/rss?v=1&ftp=ftp%3A%2F%2Fftp.ovh.net%2Fmade-in-ovh%2FbzImage&port=21&files=20
# DEPENDS :apt-get install lftp heirloom-mailx
OVH_KERNELS="ftp://ftp.ovh.net/made-in-ovh/bzImage/latest-production/"
# grsecurity + IPv6 + amd64 VPS
CURRENT="$(ls /boot/*-xxxx-grs-ipv6-64-vps)"
lftp -e "lcd /boot/; mirror -i '.*-xxxx-grs-ipv6-64-vps$'; bye" "$OVH_KERNELS"
NEW="$(ls /boot/*-xxxx-grs-ipv6-64-vps)"
if ! [ "$CURRENT" == "$NEW" ]; then
echo -e "update-grub && reboot\nnewest two:\n$(ls -1tr /boot/bzImage-*|tail -n2)" \
| mailx -s "[$(hostname -s)] new kernel from OVH" root
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment