Checking the Vista Home Premium recovery disc on this AMD Athlon 64 X2 dual core Acer before installing Debian 4.0. MythTV backend coming up.
Category Archives: Linux
Client to Server Backups
I have intentions to look into Bacula as a disk-to-disk backup solution, however until then I am using the following script for Kubuntu Dapper -> Debian Etch backups, and a modified one for Windows XP Home -> Debian Etch.
It all uses rsync, and requires password-less key based ssh connections. I am using rsync, OpenSSH, and for Windows XP a little Cygwin magic (including modifying this script to make it Windows friendly).
client-to-server-rsync-backup.sh
#!/bin/bash #ver 1.0.3 BACKUPSERVERUSER=limitedUserOnServer BACKUPSERVER=serverHostName BACKUPCLIENT=`echo $(hostname -s) | tr '[:upper:]' '[:lower:]'` BACKUPS=( #localFolder,backupDestinationParentFolder #/home,/media/md2/backups/clientname #/var/www,/media/md2/backups/clientname/var ) if [ "$1" != "--incremental" ] && [ "$1" != "--sync" ] && [ "$1" != "--help" ]; then echo $0: missing operand echo Try '$0 --help' for more information. elif [ "$1" = "--help" ]; then echo " Usage: $0 [OPTION]... [PASSTHROUGH OPTIONS]"; echo ""; echo " Mandatory arguments:"; echo " [OPTION]"; echo " --incremental add to the existing backups"; echo " --sync sync the live data with the existing backup"; echo ""; echo " Optional arguments:"; echo " [PASSTHROUGH OPTIONS]"; echo " Passthrough options are sent to rsync in this form from this script:"; echo ""; echo " for incremental:"; echo ' sudo rsync -avz [PASSTHROUGH OPTIONS] $SOURCE $BKUPSRVUSER@'; echo " $BKUPSRV:$DEST"; echo ""; echo " and for sync:"; echo ' sudo rsync -avz [PASSTHROUGH OPTIONS] --delete $SOURCE '; echo " $BKUPSRVUSER@$BKUPSRV:$DEST"; echo ""; echo " * This makes it easy to do something like this:"; echo " * $0 --incremental "--partial --progress""; echo " *"; echo " * Thus sending "--partial --progress" to rsync,"; echo " * making this script a little more interactive..."; echo " * read more via `man rsync'."; else if [ "$1" = "--incremental" ]; then incremental_or_sync=""; elif [ "$1" = "--sync" ]; then incremental_or_sync="--delete"; fi for BACKUPS in ${BACKUPS[@]}; do SOURCE=`echo $BACKUPS | cut -d',' -f1` DESTINATION=`echo $BACKUPS | cut -d',' -f2` echo echo "# starting backup" echo "# from: $BACKUPCLIENT:$SOURCE" echo "# to: $BKUPSRV:$DEST" echo echo sudo rsync -avz $2 $inc_or_sync $SOURCE $BKUPSRVUSER@$BKUPSRV:$DEST sudo rsync -avz $2 $inc_or_sync $SOURCE $BKUPSRVUSER@$BKUPSRV:$DEST echo done fi
Motion Capture Sorting
When using Motion for a security camera setup, it can generate a lot of files… One installation I have setup has “Encode movies in real-time” enabled, so not only are there many .jpgs in the capture directory, but also .avis.
This can become quite tedious… copying and pasting them from a GUI every day. Consequently, I would let the files simply pile up for a few days before moving them around. Then it became a big job.
Scripting to the rescue. The following below is a PHP-CLI script, that when run from the motion capture directory will sort the various files into a nice little structure that allows for dropping the .avis into a play list for viewing, and keeps the .jpgs around for backup.
#!/usr/bin/php <?php $fileExtOne = ".jpg"; $fileExtTwo = ".avi"; $fileNameArray = array(); //dump filenames (ending in .jpg or .avi) //in current directory into array if ($handle = opendir(".")) { while (false !== ($file = readdir($handle))) { if (substr($file, -4) == $fileExtOne || substr($file, -4) == $fileExtTwo) { array_push($fileNameArray, $file); } } closedir($handle); } //make multi-dimensional array with substrs of filename for ($i=0; $i<count($fileNameArray); $i++) { $fileNameSplit = split("-",$fileNameArray[$i]); $dirArray[$i]["group"] = $fileNameSplit[0]; $dirArray[$i]["year"] = substr($fileNameSplit[1], 0, 4); $dirArray[$i]["month"] = substr($fileNameSplit[1], 4, 2); $dirArray[$i]["day"] = substr($fileNameSplit[1], 6, 2); $dirArray[$i]["name"] = $fileNameArray[$i]; } //create unique array with new directory names and mkdir them for ($i=0; $i<count($dirArray); $i++) { $dirNameArray[$i] = $dirArray[$i]["year"] ."-". $dirArray[$i]["month"] ."-". $dirArray[$i]["day"] ."/". $dirArray[$i]["group"]; } $uniqueNewDirNames = array_unique($dirNameArray); foreach ($uniqueNewDirNames as $value) { $splitUniqueDirNames = split("/", $value); mkdir($splitUniqueDirNames[0], 0755); mkdir($splitUniqueDirNames[0] ."/". $splitUniqueDirNames[1], 0755); } //move files into the appropriate directories for ($i=0; $i<count($dirArray); $i++) { if (substr($dirArray[$i]["name"], -4) == $fileExtOne) { rename($dirArray[$i]["name"], $dirArray[$i]["year"] ."-". $dirArray[$i]["month"] ."-". $dirArray[$i]["day"] ."/". $dirArray[$i]["group"] ."/". $dirArray[$i]["name"]); } if (substr($dirArray[$i]["name"], -4) == $fileExtTwo) { rename($dirArray[$i]["name"], $dirArray[$i]["year"] ."-". $dirArray[$i]["month"] ."-". $dirArray[$i]["day"] ."/". $dirArray[$i]["name"]); } } ?>
Here’s what find returns after running the script on the capture directory full of sample .avis and .jpgs.
username@workstation:~/captures> find . . ./2008-01-06 ./2008-01-06/01 ./2008-01-06/01/01-20080106145755-02.jpg ./2008-01-06/01/01-20080106145755-04.jpg ./2008-01-06/01/01-20080106145756-00.jpg ./2008-01-06/01/01-20080106145757-00.jpg ./2008-01-06/01/01-20080106145757-01.jpg ./2008-01-06/01/01-20080106145758-00.jpg ./2008-01-06/01/01-20080106145758-01.jpg ./2008-01-06/01/01-20080106145758-02.jpg ./2008-01-06/01/01-20080106145758-04.jpg ./2008-01-06/01/01-20080106145758-05.jpg ./2008-01-06/01/01-20080106145758-06.jpg ./2008-01-06/01/01-20080106145759-00.jpg ./2008-01-06/01/01-20080106145808-01.jpg ./2008-01-06/01-20080106145755.avi
Ubuntu Update Manager
I know there seems to be a lot of Ubuntu Fanboy-ism out there, but I must say, the Update Manager that runs in Gnome is bar far -the best- one I have ever used. I remember the one that tried to run in Redhat 9: barely usable. The one in OpenSuse 10.1: worthless.
I don’t really appreciate the constant kernel updates however with any system… because then you have to reinstall modules, blah blah blah… especially for things like MythTv.
A Currency Exchanger
I wrote a little program called Exch that simplfies currency exchange and the retrieval of up to date exchange rates.
If you are already using Firefox 1.5 extensively it integrates well as a sidebar.
- View a flash movie from the project site that shows visually how to install the extension in Firefox 1.5
- Install the Firefox 1.5 Extension
- -or- download the standalone desktop application for either Linux or Windows.
More:
Other extensions I have been involved with.
Exch project on Mozdev.
Exch for Linux
I just uploaded Exch for Linux. It was excitingly difficult to make a tar.gz file off of the command line because Ark wasn’t playing nice on Kanotix.
For those who would like to make a tar.gz file of an entire directory, here’s how:
tar -cvf filename.tar directoryName
And then issue this command:
gzip filename.tarVoila, you should have:
filename.tar.gz
Software Installation
Linux is getting easier than Windows to get programs working!
Paint program for KDE
My searching is over. I have found a paint program for Linux that allows me to draw a single straight line, a square, a circle or tons of other geometry. Doing this in the GIMP (Gnu Image Manipulation Program) is a sore pain. But now that I have found this, my pain will be no more.
Let’s make this like an S.A.T. test. Gimp is to Photoshop as _____ is to Microsoft Paint Brush.
The answer: KolourPaint.
Only it is way better than Paint Brush. Check it out for all of your simple drawings and figures you have to make. They even have “Linux Distribution Independent-Binaries.” Works good on Fedora Core 1.
URPMI
These days, using Mandrake Linux 9.2 as my home desktop, I have found a certain type of tool almost too good to be true for a Linux user (at least it used to be, it has been around for awhile now.) Easy package management. A non-Linux user might ask, “What is a package?” and also “How was it before easy package management?”
When I first looked at Linux in ’99 and ’01 I found it to be severely difficult for an untrained Unix user to install programs. I decided to bypass Linux and use Windows where things seemed to be easy. Besides, I reasoned, why fiddle with this mess, I wanted to get work done on my computer!
A couple of years went by and I wanted to build my own computer, but figuring the cost of Windows into the the project wasn’t an option. I decided it was time I take a look at Linux again. To my surprise things had gotten quite a bit easier to use… except again for the packaging. Okay, Okay, what is a package? There are several different types of packages on Linux (tgz, deb, rpm) but I will concentrate on rpm. Rpm stands for Redhat Package Manager. It initially made installing software on Redhat Linux easier, but had grown into a format used by a wide variety of Linux distributions. The main ones that I can think of are Redhat/Fedora, SUSE, and Mandrake Linux.
The packages were released in a distribution specific file. So you might find an rpm build specifically for Fedora Core 1, SUSE 9.1, or Mandrake Linux 9.2. The package is similar to an install file (setup.exe) in Windows. “Wow! I double click the rpm and the program installs!” was my first reaction.
Most rpm files however required that certain software already be installed on my computer. At times these could be some really obscure files due to the wide array of open source tool kits, widgets, window managers, etc… So if my computer didn’t have a specific .so file (similar to a .dll file in Windows) the software couldn’t run.
I decided to plug away and learn how to be a real man. I would have to continue on the long and arduous journey of compiling and searching for missing dependencies. I heard of numerous similar stories of people running into “dependency-hell.” While maybe not the nicest term, it aptly described the situation of many people trying to install software on Linux. Hours of grueling work and searching on the net to get something up and running on your system. My double clicking software installing days were over… because the typical went something like this:
I would find a brand-new-super-cool-neato program that I was just dying to run. Obviously if I didn’t have this program my computer would not be super cool anymore. I would download the rpm file and double click it or type “rpm –i packagenamehere.rpm.” at the command line to install. Oh boy… here we go… missing dependencies. Sometimes I would throw in the “–nodeps or –force” into the mix to see if it would help. Often times it would not. Okay, download that file it says it is missing and install it… oh wait, that file has missing dependencies also!
I began to get tired of searching out missing shared object files to run some obscure package only to find out that when I found the package that had the file in it, it also needed another altogether different package so that it too could be installed. I thought, is this what “manhood” is all about?
Amidst my searching for better days in Linux-land I found a program called YUM. Yellow dog Updater, Modified was the official lingo behind the acronym. It was just what I was looking for. To quote from the YUM webpage (http://linux.duke.edu/projects/yum/),
“Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm.”
While a great program for Yellow dog Linux or Redhat/Fedora, I couldn’t seem to get it working for Mandrake. (The main reason behind the switch to Mandrake from Redhat by the way, was that ALSA would find my two sound cards in Mandrake while in Redhat it would not without significant messing around with config files).
Enter Urpmi. Urpmi is Mandrake’s program for easily installing and updating packages. If I have my repositories setup correctly, I barely ever think of dependencies anymore. It truly is amazing. It even has a graphical front end to the system.
I click the check boxes in front of the programs I want, bingo, software downloads and installs on my computer. It could be compared to Lindows’ Click-n-Run warehouse. Only free!
That’s the story. Here’s the info. If you want to setup your Urpmi repositories for maximum easy-ness for program installage on your computer, visit some of the following sites. Remember, these places often deal with the command line side of Urpmi as it is a command line utility. However, once you have the repository setup with Urpmi you can use Mandrake’s install utility, Rpmdrake. Rpmdrake is a graphical user interface to Urpmi. If you have Mandrake installed, search for it in your menus.
Urpmi Info
Urpmi mini-HOWTO – http://myweb.tiscali.co.uk/eggnbacon/docs/urpmi-howto/
Easy Urpmi setup – http://urpmi.org/easyurpmi/index.php
Urpmi Repositories
http://norlug.org/~chipster/rpm_index.pxml?cat=4
http://plf.zarb.org/packages.php
http://rpm.nyvalls.se/index9.2.html
http://sluglug.ucsc.edu/macromedia/site_ucsc.html
Jumpman Jr. and the Commodore
My personal computing days have changed. I can remember so fondly putting in the tape into my Commodore 64 tape drive and waiting 20 minutes for a game such as Jumpman Jr. to load up. It’s a wonder I can wait 20 seconds for anything to load now.
I just got finished playing some classics on Mandrake 9.2. I setup the VICE emulator and downloaded some roms from http://www.c64.com. I can just see it now…. Seven Cities of Gold, Wizard of War… (wait was that Atari 2600?) Jordan vs. Bird, Bumpn’ Jump and tons of others…
It’s different though… I’m older, I’ve played those games a million times, and the play value wears off quicker… but what fun! Now I can increase the speed, take screen shots, and then write about it on the web when I am done. Yeah technology!
