A Universal Updater Script for Lazy Linux Users

Being who I am, I have multiple computers running different services, and I always want them to be up to date.  However, I’ve got a big problem: I’m Lazy.  Lazy people don’t like routinely running updates on several computers, and we like it even less when the computer takes hours to update (and then breaks) whenever we do get around to it.  Luckily, there is a solution.

The other day, while waiting for my bus home in the rain, I had an idea.  I realized that if I didn’t have to move from computer to computer and do stuff on each, I would be much more willing to do updates.  Thinking in this vein, I decided that I could write a script that would simply go through each computer and run its update commands, keeping everything current and saving me a handful of keystrokes.  Now I’m no master of scripting, but anyone can string a few commands together.  Here’s what I came up with:


#run updates on laptop, desktop, and server
#runs on laptop
#add updates for backup box when that is ready

echo 'note: give root passwords for each machine when prompted'
echo 'laptop: pacman -Syyu'
su -c - root 'pacman -Syyu'
echo 'desktop: equo update && equo upgrade'
ssh root@desktop equo update && ssh root@desktop equo upgrade
echo 'desktop: emerge --sync && layman -S'
ssh root@desktop emerge --sync && ssh root@desktop layman -S
echo 'server: emerge --sync'
ssh root@tux emerge --sync
echo 'server: emerge --update --deep world'
ssh root@tux emerge --update --deep world

Now this may need a bit of explanation.  The commands pacman, equo, and emerge are the different commands used to update each distribution I’m running.  They are Arch, Sabayon, and Gentoo Linux.  I’ve named them based on their function, with the exception of my server, tux.

You’ve probably noticed the reference to a backup box in the comments that start my script; I’ll have more details on that project as soon as I get started with it.  It’s one of the more exciting plans I have lined up to complete before summer.

A bit more information and a link to download this script is available on my website at http://mankindisone.com/my_stuff.html.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: