Handling power outages with an uninterruptible power supply and NUT

The main reason for having a UPS is to protect against data loss due to power outages whether it be unsaved work, or corruption due to the computer not having enough time to write things to disk. I only really started to take this seriously when I got my Synology networked attached storage (NAS) which holds all my data.

The UPS I chose is an APC model with 1300VA and a USB connection, which is powerful enough to power most of the critical equipment I have at home and to ensure they have enough time to shut down. One of the advantages of having an uninterruptible power supply (UPS) with a USB connection is that it is possible to smartly shut down any computers during a power outage.

My strategy is when the UPS goes on battery, I want the Windows PC and Linux server to shut down immediately (well after a 1 minute timeout). These are the heaviest load (roughly 100W each on idle) on the UPS and they aren’t running anything really important that I need during a power outage; they just need to shutdown cleanly. The Synology NAS is a lighter load so I don’t mind keeping that one on and only shut it down when the UPS battery is low. Keeping the cable modem and wireless router allows me to continue to have network access which is critical for NUT to work, but also for general productivity in case of a prolonged failure). I’ve found in past outages that the cable equipment in my apartment building has some sort of separate or backup power source as well so generally the internet can continue to work. With just the cable modem, router and Synology the power draw is about 50W. I can manually shut down the NAS if I want to prolong the network even further.

What’s this NUT you keep talking about?

NUT stands for Network UPS Tools which are a set of utilities that are cross platform and cross manufacturer that monitors and responds to changes in UPS statuses. As we will see in the following sections, Synology NAS already has built in support for NUT, and NUT tools can be installed on Windows and Linux.

Continue Reading

Saving keystrokes with a SSH client config file

I regularly have to SSH into my servers, and on most of the ones I connect to the SSH server is running on a non-standard port for obvious security reasons.  I used to include the port number manually in the SSH command, for example:

[shell]
ssh seymour.dennistt.com -p 922
[/shell]

This worked… as long as I remembered to type the port number in, which was probably less than half the time on the first go.  So I finally got tired of having to retype the command with the port number in it.  Luckily you can create a SSH client configuration file which will remember this for you, and even give you a shortcut.
Continue Reading

XDMCP Login from Mac to Lubuntu 11.10

My old desktops run Lubuntu (Ubuntu but lightweight!) 11.10, which just became part of the official Ubuntu release.  Life is a lot zippier in Lubuntu compared to Ubuntu when you’re on Pentium III and Celeron machines.

I wanted to be able to login to these computers remotely with a GUI, sort of like Microsoft’s Remote Desktop but Linux style.  I didn’t want VNC because I wanted to be able to create a new login session instead of using the main console. Luckily XDMCP does exactly that and most of it is built into Ubuntu.

The Setup

Following one question previously posted on AskUbuntu, I proceeded to add the following snippet to /etc/lightdm/lightdm.conf:

[XDMCPServer]
enabled=true

Logging In

Then following the procedures posted by David Winter, I opened Terminal on my Mac, and typed in: /usr/X11R6/bin/X -query 192.168.0.1 (replace 192.168.0.1 with the IP address of your Lubuntu computer).  After a few moments the Ubuntu login screen showed up.  Perfect!

Terminal Shortcut

I made myself an alias so that I wouldn’t have to remember the complicated command line.  In ~/.bash_profile, I added:

alias xdmcp="/usr/X11R6/bin/X -query"

So now I can start a XDMCP session by typing in

xdmcp 192.168.0.1

htop – an improved “top”

While fooling around with Linux machines, one usually at some point in time has to see what programs are running on the machine and even kill processes which have locked up. Most Linux installations come with ‘top’ as a process viewer, but it’s not too user friendly. htop is a great replacement for the default top utility. htop is an interactive process viewer for Linux machines that runs in the command line. It’s equivalent to the Task Manager found on Windows computers.

There are downfalls to top, like not being able to scroll down the process list, and easy shortcuts for sorting and managing processes. I don’t know why I haven’t found this earlier! Would have saved me a lot of time trying to figure out how to use top and why I couldn’t see all the processes.

This tutorial at Go2Linux outlines the installation method.

For the past few months I’ve been playing around with a VPS purchased from Linode (more about Linode may be blogged about at a later date). While setting things up I’ve come across many tutorials about various things, and I’ve decided to create a Linux category here just so that I can keep track of good tutorials and share them with you 🙂

Exit mobile version