Working from home – A UPS to get you through those power blinks

APC-UPS ES 650A good Uninterrupted Power Supply (UPS) can keep your equipment running through short power outages. It is a good idea no matter where you work from, but especially if you work from home. Here’s why:

Where I live power outages are common but short. Now, my primary machine is a laptop, so that will run for hours on battery (well, at least an hour), but since I need my cable modem and wireless router to connect to client systems if those devices loose power I’m basically out of business.

As I mentioned we have frequent power outages here in Concord, NH, USA but they are typically only a few seconds. That wouldn’t be a problem at all, except even a short power blip means I loose all my SSH connections! That can cause a 5 second power outage to cost me 15 minutes of work or more!

So, what do I have? Well, I’m partial to APC UPSs. They are what most of the data centers I have worked with use and they’ve got a great industry reputation.

Choosing a UPS

There are two major factors when choosing a UPS, Wattage and Volt-Ampres.

Wattage determines how much you can hook up to a given UPS. Devices generally give a wattage rating somewhere in the specs and power adapters often have them listed right on them. You’ll want to add together all the devices you wish to UPS (don’t forget about monitors) and purchase a UPS of at least that wattage, and probably a bit more.

Let’s say you have two computers which consume 85 watts, a monitor which consumes 120 watts, a cable modem which consumes 15 watts and a wireless router which consumes 7 watts (this is about my configuration.) That means I need a UPS which will support a maximum draw of at least 312 watts.

The Volt-Ampre calculation is a bit more complicated. This will determine how long the UPS will be able to supply power to your devices.

Correction: I had originally mistaken Volt-Ampre for Amp-Hours. Volt-Ampre is actually similar to watts except VA is more accurate for the complex power consumption in our computers. Higher is still better, but it doesn’t mean the UPS will necessarily last longer.

To determine the capacity of a UPS we would need to know the Amp-Hours of the battery. Unfortunately most (if not all) producers fail to publish this information so we the consumers are left trusting the manufacturers documentation to determine duration.

I ended up going with the APC Backup-UPS ES 650. At 65 VA and 450 max wattage for under $100 it was the right balance of cost and capacity for me. The delivered software also allows the unit to be connected via USB to a Mac or PC to adjust power management when running on the UPS similarly to how you can have different power settings on a laptop for when you are running on battery.

Special Permission Modes in Linux and UNIX

There are a few special permission mode settings that are worthy of noting. Note that the Set UID and Set GID permissions are disabled in some operating systems for security reasons.

Mode Description
Sticky bit Used for shared directories to prevent users from renaming or deleting each others’ files. The only users who can rename or delete files in directories with the sticky bit set are the file owner, the directory owner, or the super-user (root). The sticky bit is represented by the letter t in the last position of the other permissions display.
SUID Set user ID, used on executable files to allow the executable to be run as the file owner of the executable rather than as the user logged into the system.
SUID can also be used on a directory to change the ownership of files created in or moved to that directory to be owned by the directory owner rather than the user who created it.
SGID Set group ID, used on executable files to allow the file to be run as if logged into the group (like SUID but uses file group permissions).
SGID can also be used on a directory so that every file created in that directory will have the directory group owner rather than the group owner of the user creating the file.

The following example displays the SUID permission mode that is set on the passwd command, indicated by the letter s in the last position of the user permission display. Users would like to be able to change their own passwords instead of having to ask the System Administrator to do it for them. Since changing a password involves updating the /etc/passwd file which is owned by root and protected from modification by any other user, the passwd command must be executed as the root user.

The which command will be used to find the full path name for the passwd command, then the attributes of the passwd command will be listed, showing the SUID permission(s).

$ which passwd
$ ls -l /usr/bin/passwd
-r-s--x--x 1 root root 17700 Jun 25 2004 /usr/bin/passwd

Here we see not only that the SUID permissions are set up on the passwd command but also that the command is owned by the root user. These two factors tell us that the passwd command will run with the permissions of root regardless of who executes it.

These special modes can be very helpful on multi-user systems. To set or unset the sticky bit use the the t option with the chmod command. When setting the sticky bit we do not have to specify if it is for user, group or other. In the following example we will make a directory called public which anyone can write to but we’ll use the sticky bit to make sure only the file owners can remove their own files.

$ mkdir public
$ chmod 777 public
$ chmod +t public
$ ls -l
total 4
drwxrwxrwt 2 tclark authors 4096 Sep 14 10:45 public

We see that the last character of the permissions string has a t indicating the sticky bit has been set. We could also prefix the number 1 to the chmod command using the number to achieve the same results. The following chmod command will accomplish the same thing as the two chmod commands in the last example:

$ chmod 1777 public
$ ls -l
total 4
drwxrwxrwt 2 tclark authors 4096 Sep 14 10:45 public

Now let’s say we instead want to make a directory which other users can copy files but which we want the files to instantly become owned by our username and group. This is where the SUID and SGID options come in.

$ mkdir drop_box
$ chmod 777 drop_box
$ chmod u+s,g+s drop_box
$ ls -l
total 4
drwsrwsrwx 2 tclark authors 4096 Sep 14 10:55 drop_box

Now anyone can move files to this directory but upon creation in drop_box they will become owned by tclark and the group authors. This example also illustrates how you can change multiple levels of permissions with a single command by separating them with a comma. Just like with the other permissions this could have been simplified into one command using the SUID and SGID numeric values (4 and 2 respectively.) Since we are changing both in this case we use 6 as the first value for the chmod command.

$ chmod 6777 drop_box/
$ ls -l
total 4
drwsrwsrwx 2 oracle users 4096 Sep 14 10:55 drop_box

Easy Linux CommandsFor more tips like this check out my book Easy Linux Commands, only $19.95 from Rampant TechPress.

Buy it now!

unix, linux, system administration, sysadmin

Seven Deadly Habits of a DBA

In my travels today I came across the Pythian Group’s Seven deadly habits of a DBA… and how to cure them.

Citing such pitfalls as blind faith in backups, lack of monitoring and finger pointing we’ve all seen these symptoms at one point or another, and they’re all worth some attention. While many of these are largely a product of inexperience I’ve seen my favorite, number 4, The Memory Test at all levels. The “if it happens again I’ll remember how we fixed it” syndrome is often a product of another environmental problem, a lack of documentation procedure. This exact problem is one reason I started blogging in the first place!

Check out the whole list, including their suggested cures for these problems.

dba, database, database administration, oracle

Bestselling Oracle books and a bit about the biz

Don Burleson has an interesting artucle about some of the bestselling Oracle authors. Perhaps more interesting than the actual list is Don’s comments on how the book market has changed from the 90’s to the 00’s. He also talks a little about how royalties work.

Fair to say that today’s Oracle author (me included) isn’t expecting to get rich from their books, but it remains a great way to increase your personal visibility, give a subject a more complete treatment than it might otherwise get and help ease the learning curve for others who are less experienced.

oracle, technology, book, books, book sales, author, writing, publishing, royalties

Beer Launching Fridge

Another great alcohol delivery system:

The Hole – video powered by Metacafe

This is certainly not without its flaws; most notable that it dispenses cans which I’m sure will be well shaken after the toss and catch. Its no Bar Monkey, but you’ve gotta respect the effort.

via Make

drink, drinks, drinking, beer, alcohol