DynDNS and kernel stripping for Ubuntu
This commit is contained in:
parent
5a05bf120a
commit
7deda15585
9
remove_old_kernels.sh
Normal file
9
remove_old_kernels.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Remove all but the latest $keep kernels (and headers)
|
||||||
|
#
|
||||||
|
keep=2
|
||||||
|
sudo aptitude purge $(
|
||||||
|
for i in linux-headers-[0-9]*[0-9] linux-headers-[0-9]*generic linux-image-[0-9]* linux-image-extra-[0-9]*; do
|
||||||
|
dpkg -l $i 2>/dev/null | grep ^ii | awk {'print $2'} | grep [0-9] | sort | head -n -${keep};
|
||||||
|
done
|
||||||
|
)
|
34
update_ip.sh
Executable file
34
update_ip.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cache=.update_ip.cache
|
||||||
|
server=ns1.example.com
|
||||||
|
zone=dyn.example.com
|
||||||
|
host=desktop
|
||||||
|
secret=""
|
||||||
|
|
||||||
|
ip=$(wget -q -O - http://alma.ch/myip.cgi)
|
||||||
|
|
||||||
|
if [ -z ${ip} ] || [ -z ${cache} ]; then
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${HOME}/${cache}" ]; then
|
||||||
|
old_ip=$(cat "${HOME}/${cache}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${ip}" = "${old_ip}" ]; then
|
||||||
|
exit;
|
||||||
|
else
|
||||||
|
rm -f "${HOME}/${cache}"
|
||||||
|
echo "${ip}" > "${HOME}/${cache}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF | nsupdate
|
||||||
|
server ${server}
|
||||||
|
zone ${zone}.
|
||||||
|
key ${host}.${zone} ${secret}
|
||||||
|
update delete ${host}.${zone}.
|
||||||
|
update add ${host}.${zone}. 60 A $ip
|
||||||
|
update add ${host}.${zone}. 60 TXT "Updated on $(date)"
|
||||||
|
send
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user