January 11, 2008

Make Backups to Prevent Grief

Posted in Linux/Zaurus Tips and Tricks, Zaurus Trials and Tribulations at 6:06 am by sdjf

Geeks will be geeks and hackers will be hackers, and any time one of us messes around writing scripts or going on a cleanup campaign, IMNSHO, it is just plain stupid to not make backups. It also is rather foolhardy to install new software on the Zaurus without making a backup immediately beforehand, at least that’s been my experience when trying to install some packages that ended up trashing my system.

One day about a month ago, silly me had not made a backup in about four weeks, being too preoccupied with other things to want to take the time to change cards around to do it, and I sure paid a price for that stupidity.

I was working on a script to automatically move and rename all selected files in the .operasave directory on my SD card, and erase all the rest of those files in each subdirectory that I was processing, as well as removing those specific .operasave subdirectories.

I had thought I had tested the complex chain of commands I was entering thoroughly, but somehow they ended up erasing the all the files in my home directory, /home/root, except those it hadn’t gotten to by the time I entered ctrl-c, those starting with letters a thru p or starting with any capital letters. So, then I spent an hour or two fetching month-old versions of the files it had not removed, using the technique I described here, about how to retrieve single files from a tar backup. (To retrieve an entire directory, you can read this page.)

Anyhow, after restoring the files, silly me turned right around and went back to work on my SD card operasave directory cleanup script without bothering to make a newer backup. I put a test in to have it check for valid arguments. I ran a few tests. Then I went into production mode, and this time managed to erase an even larger number of files. Grrrr.

So, my Collie’s calendar application now will remind me weekly to make backups. When I write scripts that are like this one, I am also going to build in changing to a directory that does not matter if the contents get erased, like /var/log.

Advertisements
%d bloggers like this: