Guest Blogger: Keith Murray
Earlier this year I switched my web hosting from my long-time account at DreamHost to a fancy new VPS at Linode. I really did enjoy my time with DreamHost, but what I wanted out of my hosting provider had changed somewhat. I was looking for full control of a machine in the cloud. Although DreamHost does offer a VPS option, the pricing options just didn’t compare with what Linode was offering.
I also took the opportunity to move my domain registrations over to Hover, but more on that another time.
With my Linode account managing the DNS for my domains I was able to point a a single subdomain back at the IP of my home network, effectively giving me a nice publicly accessible domain from within my network. This worked well until my ISP changed the IP address I had. Admittedly this doesn’t happen often, but it always seems to occur when I actually need to make use of this remote connection, and with no knowledge of my new public DHCP address it’s pretty useless.
With some modifications to a script I found on GitHub I was able to quckly set up job to check my public IP address and update the DNS records at Linode using the Linode API. I hacked apart the original script and put together my own DDNS update script, suitable for automating.
By scheduling the script to run using a simple crontab entry I can rest assured that every night, while I’m asleep, my server will be connecting to Linode to point the way home.
Keith Murray is a software architect and developer who blogs about technology and science at kdmurray.net. He can also be found on twitter as kdmurray.
One of the very annoying things about having multiple Linux systems (or virtual machines) in the house is that you constantly need to keep them patched and updated. Sure, they are not as vulnerable as some Windows systems but it is still good practice to keep your systems nicely patched. So instead of doing sudo apt-get upgrade every time (or worse , getting a popup from the update manager while you are just in the middle of watching your favorite Youtube video about bunnies ) .. lets schedule this.
Scheduling things is not bad , but you have to be careful just WHAT you want those systems to do. You don’t want to wake up one morning and see that your LTS (long term support) workstation has just done a make-over and rolled onto the cutting edge version of the new release of your operating system. So kernel and distro upgrades should not be a part of your schedule.
The command we choose to use is Aptitude. With the following string you can do an update and upgrade on the same line.
/usr/bin/aptitude -y update && /usr/bin/aptitude -y safe-upgrade
So what does it do ?
“-y” makes sure that you don’t have to type YES at the end of the command.
” safe-upgrade” means that kernell or distro upgrades are a “nono”
“&&” links the commands together.
How to schedule it.
Simple. Log in as a user with root access and type “crontab -e”
next ad the following line to your cron
0 1 * * * /usr/bin/aptitude -y update && /usr/bin/aptitude -y safe-upgrade
Thats it. Now the the upgrade is executed every single night at 1 am.
source. Kevin van Zonnevelds blog.
We show you a very simple tool how to use twitter from the command line, teach you how to schedule your tweets with Cron and create your own personal twitter assistant. With some cool and smart hacks for anyone to master we create your own virtual twitter butler (or imaginary friend)