Life of a Geek Admin

The Daily adventures of a true geek administrator

Life of a Geek Admin - The Daily adventures of a true geek administrator

Data Crow for Collection Cataloging

Recently I took on the task to catalog my video and music collection. This need was driven by the fact that I was purchasing duplicate movies. The criteria was simple. It had to be able to use a barcode scanner, handle movie and audio collections, more if possible and have connections to access IMDB, Amazon and others if possible and able to run on different OS’s. And lastly the cost had to be reasonable or free. If free then a donation to the developer was in order.

After searching I found several options to try but ended up on looking at Data Crow. Data Crow is the ultimate media cataloger and media organizer. Always wanted to manage all your collections in one product? You want a product you can customize to your needs? Your search ends here! Using Data Crow allows you to create a huge database containing all your collected items. You can use the excellent online services to retrieve the information instead of typing all the information yourself.

A few features:

  • Platform independent and completely portable
  • Highly customizable and feature rich.
  • Audio, software, book, movie and photo collection cataloger
  • Retrieve information from services like Amazon.com, Imdb.com, Softpedia and MusicBrainz.
  • Optional internal web server and web GUI.
  • Import file information (mp3, divx, xvid, ..)
  • Loan registration.
  • PDF and HTML reporting.
  • Create new modules to, for example, maintain your stamp collection.
  • Available translations: Italian, German, Dutch, English, Spanish and French.

Data Crow is 100% free and 100% free of ads, viruses and spyware. Data Crow runs on any system where Java 1.6 (or higher) from Sun is installed.

The barcode scanner is an Adesso Nuscan 1000u which is a low cost USB scanner that will work well for the job and is supported by Data Crow. The nice thing about the Adesso barcode scanner is that you plug it in and it works, no drivers needed.

Installation is simple for Windows just download , unzip it and run the installer. One note for the Windows installation is to change the installation directory to c:\Data Crow instead of c:\program files\data crow.  the reason for the change is due to an issue with directory and file restrictions that can cause issues with Data Crow.

Installation on Linux and MAC is just as easy. Download and unzip the program. To start the program change to the extracted directory and run datacrow.sh.

Now that we are installed lets start it up and get started adding movies! Start up Data Crow and you will be greeted by a simple interface.

At start up you will be ask to select the modules. For my choice I selected all and after a few quick moments I was on my way. Select the module you want to add, in this case I am adding a DVD using the barcode scanner.

Click on Item Wizard and you will have several selections to choose from to search in the drop down next to Search For window. If you do not have a barcode scanner you can type in what you are looking for and select the appropriate category to select from in the drop down. If you do have a barcode scanner select UPC barcode and scan the barcode of the movie.

At this point you can select a different server to search from or accept the default of Amazon and click on the Find button.

Select from one of the search findings and click on Next. At this point Data Crow will connect and download any information retrived from the search. Click Finish to add the data into your collection.

Not to bad, easy to use and with a barcode scanner it will take little time to add the collection.

I have only covered the basic of this powerful collection application. Please download and try the application and hopefully you as I can quickly and easily add your collection. Look for future posts on more you can do with Data Crow.

Installing Capistrano on Fedora 16

Recently there has been a need to deploy a package with customization to several hundred systems and we looked to use Capistrano to make the deployments.

According to the site Capistrano is a developer tool for deploying web applications. It is typically installed on a workstation, and used to deploy code from your source code management (SCM) to one, or more servers. It can also be used for delivering solutions.

This post just explains how to install Capistrano on Fedora 14 – 16 on your system.

Open a terminal and we’ll need to install ruby, rubygems and rubygem-rails.

$ sudo yum install ruby rubygems rubygem-rails

Next we need to install the capistrano gem module.

$ sudo gem install capistrano

And that’s all we need to do. Refer to Capistrano site on recipes on using Capistrano.

Install BlueGriffon Web Editor on Fedora 16 x64

Just recently had the need to try out a new wysiwyg web editor and remember from years ago using NVU which is a simple graphical editor based on Netscape / Gecko engine. Development stop and was taken up by Kompozer which was stopped as well, but now has new life under BlueGriffon.

BlueGriffon is a new WYSIWYG content editor for the World Wide Web. Powered by Gecko, the rendering engine of Firefox 4, it’s a modern and robust solution to edit Web pages in conformance to the latest Web Standards.

There are a few prerequisites to install first when running 64 bit for the 32 bit libraries.

Open a terminal and run the following commands.

$ sudo yum install libXt.i686 oxygen-gtk.i686 oxygen-gtk gtk2-engines.i686

This will install all the needed libraries for BlueGriffon. Now lets download BlueGriffon itself from here. The current version at this writing is 1.4.

Now lets install it.

$ sudo rpm -Uvh bluegriffon-1.4-1.fc16.i686.rpm

That’s all that is needed and now we are ready to fire it up and start editing. When opening up the program you will receive a simple but effective interface.

There are several free addons available here and also pay addons. If you want a free, lightweight GUI editor then BlueGriffon is the one for you.

Using Powershell to Parse Event Logs

Powershell is a well needed addition to Windows. For a longtime there has been Windows admins wanting a powerful and flexible scripting language similar to what Linux / Unix users have had for years, or at least I have.

One of the great command line tools for Linux has been the use of commands like cat, less, more and grep as a few to parse files. Enter in Powershell for Windows. A recent need for parsing the application event log for specific event id 3001 and ASP .NET errors causing an issue with SharePoint servers. With Powershell we can achieve this by using the get-eventlog cmdlet and the where statement to look for the match.

As part of the requirements to the script I wanted to have the ability to put a limit on how far back to look in the application log, write it to a file and if it finds an event that occurred today then send me an email. Here is what came out of it.

# parselogevent.ps1
# Checks for events less than 7 days that occur today and emails.
#

del C:\logs\lastevent.txt

$Now = Get-Date
$SubtractDays= New-Object System.TimeSpan 7,0,0,0,0
$Then = $Now.Subtract($SubtractDays)

$lastevent_log=get-eventlog application -after $Then -before $Now | where {$_.Message -match “3001″ -and $_.Source -match “ASP.NET 2.0.50727.0″} | format-table -wrap -autosize -property TimeWritten, Message > C:\Support\lastevent.txt

$lastevent_file=[io.file]::ReadAllText(‘C:\logs\lastevent.txt’)

$files = “C:\logs\lastevent.txt”

$exist = test-path $files

$today = (get-date).ToShortDateString()

$file = get-childitem $files

if($file.length -gt 0){
$emailFrom = “myemail@myhost.com”
$emailTo = “theman@theman.com”
$subject = “Timeout Error  $env:COMPUTERNAME”
$body = $lastevent_file
$smtpServer = “my.smtp.com”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
$lastevent_log.TimeWritten|Set-Content C:\logs\lastevent.txt
}

Now lets explain how it works!!!

First line we want to delete any log exports from before

del C:\logs\lastevent.txt

Now we need to set the variables for date, math to set 7 day and then calculate it all.

$Now = Get-Date
$SubtractDays= New-Object System.TimeSpan 7,0,0,0,0
$Then = $Now.Subtract($SubtractDays)

Now the meat. Lets parse the log an find event id 3001 with message containing ASP.NET 2.0.50727.0 and export to lastevent.txt.

$lastevent_log=get-eventlog application -after $Then -before $Now | where {$_.Message -match “3001″ -and $_.Source -match “ASP.NET 2.0.50727.0″} | format-table -wrap -autosize -property TimeWritten, Message > C:\Support\lastevent.txt

At this point you could look at the exported file and see if you have any events. But we are after automation here, as we are good admins.

Next we need to create some variables to use for formatting and sending the email.

$lastevent_file=[io.file]::ReadAllText(‘C:\logs\lastevent.txt’)

$files = “C:\logs\lastevent.txt”

$exist = test-path $files

$today = (get-date).ToShortDateString()

$file = get-childitem $files

And finally the email piece, this is pretty straight forward and doesn’t need a lot of explaination as the descriptions speak for themselves. You will need to change the values for $emailFrom, $emailTo, $subject & $smtpServer.

if($file.length -gt 0){
$emailFrom = “myemail@myhost.com”
$emailTo = “theman@theman.com”
$subject = “Timeout Error  $env:COMPUTERNAME”
$body = $lastevent_file
$smtpServer = “my.smtp.com”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
$lastevent_log.TimeWritten|Set-Content C:\logs\lastevent.txt
}

Save your finished file and give it a run. If it works, then be a good admin and create a scheduled task and move on to the next.

If you want to save a little typing time just download the parselogevent.

 

Using Powershell to check service and send email

Ran into an issue with services stopping for no reason and causing IIS to stop. This was happening in the middle of the night and was sporadic in nature, making it hard to find a root cause. As a band-aid I created a Powershell 2 script to check for the service, restart if not in a running state and send and email.

Here is the script.

# Checks for a service to be running and starts if needed.
# Author: Me
# Date: 01/16/2012
# Name: checksvculti1.ps1
# must use a wrapper script with powershell script due to running at privileged access.

function FuncCheckService{
param($ServiceName)
$arrService = Get-Service -Name $ServiceName
if ($arrService.Status -ne "Running"){
Start-Service $ServiceName
FuncMail -To "myemail@yourhost.com" -From "myserver@yourhost.com"  -Subject "Servername : ($ServiceName) service started." -Body "Service $ServiceName started" -smtpServer "mysmtpserver.com"
}
}

function FuncMail {
param($To, $From, $Subject, $Body, $smtpServer)
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = $From
$msg.To.Add($To)
$msg.Subject = $Subject
$msg.IsBodyHtml = 1
$msg.Body = $Body
$smtp.Send($msg)
}

FuncCheckService -ServiceName "IISADMIN"

the script is pretty simple and really has two defined functions FuncCheckService and FuncMail. the last line of the script runs FuncCheckService  and adds the parameter -ServiceName where you define the service you want to check.

Now to modify this script you only have to change a few settings.

The line in FuncCheckService that calls the FuncMail you will need to change

  • -To
  • -From
  • -Body
  • -smtpServer

And the last line of the script is where you will define the service to check. Change value after -ServiceName to the service you want to check.

If you notice in the comments for the script I mention that is must be run in a wrapper script. The reason is do to privileges need to be run. I am running this script in Unrestricted mode. The wrapper script looks like this.

powershell.exe -command "Set-ExecutionPolicy Unrestricted -force"
powershell.exe c:\Scripts\checksvculti1.ps1

Save this file and the Powershell script with whatever names you like and in the same directory. You can now schedule this to run as a scheduled task.

Installing BackupPC

This post is how I was able to install BackupPC on my Ubuntu 10.04 server and backup Windows/Linux/Mac clients using rsync and ssh.

Client Setup (Windows 7/Vista/XP)
These instructions are written for Windows 7, Vista, or XP clients. For the SSH portion we will be using CopSSH which is a customized packaged version of the Cygwin openssh code. Rsyncd will be used as the communication for BackupPC to do it’s magic. We could install Cygwin and customize the installation which contains the code but I have found that these two separate products work well and take less configuration and time to complete.
First create a backuppc user account and add it to the Administrators and Backup Operators groups. Set it so the password never expires. Make sure every Windows user has a password set.
SSH Client/Server (Windows 7/Vista/XP)
For
CopSSH (http://www.itefix.no/i2/copssh) downloads at (http://sourceforge.net/projects/sereds/files/)
Download Copssh_3.1.3_Installer.zip.
Extract CopSSH and install the file accepting all the defaults. The installer will create a service account and generate a random password. Once installed you need to activate a user. Click Start > All Programs > Copssh > 1. Activate a User. From the drop down box for username select your user id and click Next. Type a passphrase and click Activate.
Now you need to open port 22 on the firewall.
Open Control Panel > System Security > Windows Firewall > Advanced Settings. Under Windows firewall and advanced settings click Inbound Rules. On the Right Pane click New Rule. Select Port, click next, in Specific local ports type 22, click next, click Next to allow the connection, click next to allow it through public, private and domain. Give it a name and save it. Try to connect from your server to the system.
For you command line junkies type:
c:windowssystem32> netsh firewall set portopening protocol = TCP port = 22 name = openssh mode = enable scope = CUSTOM addresses = LocalSubnet

Rsyncd

Download rsyncd from http://sourceforge.net/projects/backuppc/files/cygwin-rsyncd/ (cygwin-rsyncd-2.6.8_0.zip.
Make a folder named ‘rsyncd’ in C: and unzip the content into c:rsyncd.

Edit Configuration files
Edit c:rsyncdrsyncd.secrets and change UUU:PPP to : and save the file.

Example:
backuppc:pa$$w0rd

Edit c:rsyncdrsyncd.conf file and add the details for the information you want to backup. For this example just want to backup the documents folder for the user. So adding the following lines will take care of it.

[documents]
path = c:/users/backuppc/Documents
comment = documents
auth users = backuppc
secrets file = c:/rsyncd/rsyncd.secrets
hosts allow = 192.168.1.0/24
strict modes = false
read only = true
list = false

You can back up the whole drive and will probably want to add exceptions for directories like TEMP and others. You can do this by creating a separate text file on the server with them listed.

Save the file changes when you are done adding.

Service / Firewall Setup
From a command prompt type cd c:rsyncd press Enter
Run this command to register it as a service.
cygrunsrv.exe -I rsyncd -e CYGWIN=nontsec -p c:/rsyncd/rsync.exe -a "--config=c:/rsyncd/rsyncd.conf --daemon –no-detach"
or edit c:rsyncdservice.bat and remove the rem comments from the last 3 lines and run the command.

Automatic Wakeup/Standby

You may want to configure the clients to automatically wake up when BackupPC connects to them so they don’t need to always be on. First, configure Wake on LAN in the BIOS and configure the network interface. Under the Power Management tab set AC Recover -> Last, Suspend Mode -> S3, and Remote Wake Up -> On.

Client Setup (Linux)
SSH and rsync are standard fare on Linux. Setting them up and configuring are simple to do.
Rsync is included and just needs to be configured to run as a daemon. Edit or create the /etc/rsyncd.conf configuration file. The format is the same as the Windows systems with the exception of the drive letters. Change the values to suit your needs.

motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[Users]
path = /home
comment = User files
auth users = backuppc
secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.1.0/24
strict modes = false
read only = true
list = false
Edit /etc/rsyncd.secrets and change or add UUU:PPP to : and save the file. If the user id you want to use doesn’t exist then you will need to create it.
Example:
backuppc:pa$$w0rd
Change the permissions on rsyncd.secrets and rsync.conf to non-world readable.
$ chmod 640 /etc/rsyncd.secrets
$ chmod 640 /etc/rsyncd.conf
Restart rsync on the system.
$ sudo /etc/init.d/rsync restart

Client Setup (MAC)
Enabling SSH (Remote Access)
Enabling SSH on the MAC is easy due to the kernel being built on BSD. With that in mind, to enable SSH on the system 10.4 and higher.

1. Open System Preferences and click Sharing.
2. Click Services and select the Remote Login checkbox.
Note: Selecting Remote Login also also enables the secure FTP (sftp) service.
Rsync
Rsync is included and just needs to be configured to run as a daemon. Edit or create the /etc/rsyncd.conf configuration file. The format is the same as the Windows systems with the exception of the drive letters. Change the values to suit your needs.
[Users]
path = /Users
comment = User files
auth users = backuppc
secrets file = /etc/rsyncd.secrets
hosts allow = 192.168.1.0/24
strict modes = false
read only = true
list = false
Edit /etc/rsyncd.secrets and change or add UUU:PPP to : and save the file.
Example:
backuppc:pa$$w0rd
Change the permissions on rsyncd.secrets and rsync.conf to non-world readable.
$ chmod 640 /etc/rsyncd.secrets
$ chmod 640 /etc/rsyncd.conf

Now start rsync in daemon mode. This is done by creating rsync.plist and copying it to /Library/Startupitems/.
Rsyncd.plist

After rebooting the system rsync will be running in daemon mode waiting for a connection from BackupPC.
Server Setup (Ubuntu Linux)

BackupPC is available via the Synaptic Package Manager in Ubuntu for extremely easy installation.
Install software
Install BackupPC and sshd so you can connect remotely.
$ sudo apt-get install backuppc
$ sudo apt-get install openssh-server
Set a password for the backuppc web user.
$ htpasswd /etc/backuppc/htpasswd backuppc
Passwordless SSH
We need to setup SSH for the backuppc user. Follow the default suggestions for ssh-keygen and don’t use a passphrase. You could try to use ssh-agent or Seahorse to store the passphrases for encrypted keys, but it is difficult to ensure they are unlocked whenever the backuppc user needs them.

$ sudo -i
$ su backuppc
$ bash
$ ssh-keygen -t rsa
Setup passwordless SSH for each of the clients so the backuppc user can connect without prompts. First copy the backuppc user’s public key to the authorized_users file on each client.
ssh-copy-id username@client
or, if you don’t have ssh-copy-id, use the following where highport is the SSH port you set for the client if you secured SSH. Otherwise you can omit -P highport.

$ scp -P highport /var/lib/backuppc/.ssh/id_rsa.pub username@client:~/.ssh/backuppc_id_rsa.pub
$ ssh username@client
$ cat ~/.ssh/backuppc_id_rsa.pub >> ~/.ssh/authorized_keys
$ rm ~/.ssh/backuppc_id_rsa.pub

Global BackupPC Settings

Most of the global settings are easily configured via the web interface, at http://localhost/backuppc but you can also edit /etc/backuppc/config.pl directly.
Hosts
Define each host you want to back up. It is easiest to automate email notifications if you use the user’s email address as their username.
Xfer

ClientCharset ->; cp1252
Only choose if your primary clients run Windows – use the default UTF8 for other clients. If you don’t set this as default, you’ll have to configure it for each Windows client.
XferMethod ->; rsyncd
Regular rsync over SSH doesn’t work between Linux and Windows/Cygwin boxes because of a bug fixed in rsync 3.0. However, BackkupPC doesn’t use the features of 3.0 and the problem remains. Using rsyncd over a pre-established SSH tunnel or VPN is the best way around this.
RsyncdUserName ->; backuppc
Or whatever you call it.
RsyncShareName ->; cyg
Or whatever you call it.
RsyncdUserName ->; backuppc
RsyncdPasswd ->; password you used in the client rsync.secrets files.
Same as is hardcoded in rsyncd.conf on the clients.
BackupFilesExclude

BackupFilesExclude is easier to modify in /etc/backuppc/config.pl directly. Pick the exclude list for the primary operating system of your clients. Unfortunately, you will have to hard code the exclude list for your other clients. For example, if Windows 7 or Vista is the primary OS and XP is the only other one, use the 7/Vista excludes below in config.pl and the XP excludes in each clients clientname.pl file. You can check out the wiki page I wrote most of to get ideas for excludes for Windows 2000 or Linux.

You may also want to exclude some of the Cygwin directories like /bin, /tmp and /packages (where I told Cygwin to put the package directory during setup). Just make sure to backup /etc so you don’t lose your configuration!
7/Vista

I ran into a lot of problems on my Windows 7 and Vista machines where rsync would follow the junction points Microsoft added for backward compatibility (see this site for more info). This caused extra-long filenames rsync couldn’t handle. To find all junction points on your 7/Vista machine open the Command Prompt and run from the root of the c drive:

dir /aL /s >; c:usersUSERNAMEJunctionPoints.txt

The rules below will exclude these junction points. Rules with asterisks in them will match the junction points that are in every user profile by default without having to code excludes for each user manually. We can remove any temp data and program or system installation files as well. On 7/Vista, only original installation data is stored in Program Files. Any data programs write to their installation folder goes to ProgramData automatically instead. The Windows folder shouldn’t hold anything interesting, either.

Exclude list for Windows 7/Vista clients with the rsyncd share being /cygdrive/c:

$Conf{BackupFilesExclude} = {
#Windows 7/Vista specific!
‘*’ => [
#7/Vista junction points
'/Documents and Settings',
'/ProgramData/Application Data',
'/ProgramData/Desktop',
'/ProgramData/Documents',
'/ProgramData/Favorites',
'/ProgramData/Start Menu',
'/ProgramData/Templates',
'/Users/All Users',
'/Users/Users/Default User',
'/Users/Users/All Users/Application Data',
'/Users/Users/All Users/Desktop',
'/Users/All Users/Documents',
'/Users/All Users/Favorites',
'/Users/All Users/Start Menu',
'/Users/All Users/Templates',

#Junction points common to every user profile
'/Users/*/Application Data',
'/Users/*/Cookies',
'/Users/*/Local Settings',
'/Users/*/My Documents',
'/Users/*/NetHood',
'/Users/*/PrintHood',
'/Users/*/Recent',
'/Users/*/SendTo',
'/Users/*/Start Menu',
'/Users/*/Templates',
'/Users/*/AppData/Local/Application Data',
'/Users/*/AppData/Local/History',
'/Users/*/AppData/Local/Temporary Internet Files',
'/Users/*/Documents/My Music',
'/Users/*/Documents/My Pictures',
'/Users/*/Documents/My Videos',

#Temporary and in-use user data
'/Users/*/AppData/Local/Microsoft/Windows/Temporary Internet Files',
'/Users/*/AppData/Local/Temp',
'/Users/*/NTUSER.DAT*',
'/Users/*/ntuser.dat*',
'/Users/*/AppData/Local/Microsoft/Windows/UsrClass.dat*',
'/Users/*/AppData/Local/Microsoft/Windows Defender/FileTracker',
'/Users/*/AppData/Local/Microsoft/Windows/Explorer/thumbcache_*.db',
'/Users/*/AppData/Local/Microsoft/Windows/WER',
'/Users/*/AppData/Local/Mozilla/Firefox/Profiles/*/Cache',
'/Users/*/AppData/Local/Mozilla/Firefox/Profiles/*/OfflineCache',
'/Users/*/AppData/Roaming/Microsoft/Windows/Cookies',
'/Users/*/AppData/Roaming/Microsoft/Windows/Recent',
'ProgramData/Microsoft/Search',
'ProgramData/Microsoft/Windows Defender',
'*.lock',
'Thumbs.db',
'IconCache.db',
'Cache*',
'cache*',

#Installation folders and system data
'/Program Files',
'/Windows',
'/$Recycle.Bin',
'/MSOCache',
'/System Volume Information',
'/Boot',
'/autoexec.bat',
'/bootmgr',
'/BOOTSECT.BAK',
'/config.sys',
'/hiberfil.sys',
'/pagefile.sys'
]
};

XP

Exclude list for Windows XP clients with the rsyncd share being /cygdrive/c:

$Conf{BackupFilesExclude} = {
#XP specific!
‘*’ => [
#Temporary and in-use user data
'/Documents and Settings/*/Cookies',
'/Documents and Settings/*/Local Settings/Temporary Internet Files',
'/Documents and Settings/*/Local Settings/Temp',
'/Documents and Settings/*/NTUSER.DAT*',
'/Documents and Settings/*/ntuser.dat*',
'/Documents and Settings/*/Local Settings/Application Data/Microsoft/Windows/UsrClass.dat*',
'/Documents and Settings/*/Local Settings/Application Data/Mozilla/Firefox/Profiles/*/Cache',
'/Documents and Settings/*/Local Settings/Application Data/Mozilla/Firefox/Profiles/*/OfflineCache',
'/Documents and Settings/*/Recent',
'*.lock',
'Thumbs.db',
'IconCache.db',
'Cache*',
'cache*',

#Installation folders and system data
'/WINDOWS',
'/RECYCLER',
'/MSOCache',
'/System Volume Information',
'/AUTOEXEC.BAT',
'/BOOTSECT.BAK',
'/CONFIG.SYS',
'/hiberfil.sys',
'/pagefile.sys'
]
};

Email

EMailAdminUserName -> youremail@host.com

CGI

CgiUserConfigEditEnable -> no
You probably don’t want users editing their configuration.

Schedule

FullKeepCnt -> 4, 2, 3, 0, 0, 4
Spreads out backups exponentially over almost three years. The schedule is approximately 0wk (current), 1wk, 2wk, 3wk, 5wk, 7wk, 11wk, 15wk, 19wk, 51wk/1yr, 83wk/1.6yr, 115wk/2.2yr, 147wk/2.8yr.
FullAgeMax -> 1095
3 years.
IncrLevels -> 3, 2, 5, 4, 7, 6
This is based on the Tower of Hanoi puzzle and is a way of balancing your backups so you don’t backup the same data a bunch of times yet retain duplicate backups of the data. See Tower of Hanoi pattern for backup for more info.
BlackoutPeriods
BlackoutPeriods:hourEnd -> 1
Better for night owls
BlackoutPeriods:weekDays -> 0, 1, 2, 3, 4, 5, 6
Avoid the same times every day for a home environment.

Client BackupPC Settings
Xfer

RsyncdClientPort -> XXXXX
Pick a high (10000+) one for each client. They need to be unique to identify tunnels.

BackupSettings

ClientNameAlias -> localhost
If you want to use SSH tunnels, you have to create one beforehand and then try to connect to the rsyncd server on the localhost. This breaks the default ping command, so you have to compensate. The workaround for that requires individual attention, which is why this is changed in client settings instead of global ones.
PingCmd -> /etc/backuppc/mktnl clienthostname clientsshport localport

In order to setup the SSH tunnel beforehand, we can create script that BackupPC can run before the backup. I’m placing it in the PingCmd field so it is run when BackupPC pings the host before it starts. It also allows me to return a valid ping even though we set the alias above to localhost.

Here is the contents of /etc/backuppc/mktnl:

#!/bin/sh
host=$1
sshPort=$2
locPort=$3
remPort=873
username=backuppc
/bin/ping -c 1 -w 3 $host
/usr/bin/ssh -f -L $locPort:localhost:$remPort $username@$host -p $sshPort sleep 10 1>/dev/null 2>/dev/null && echo “SSH tunnel started successfully.”

The ping command returns its results to BackupPC and the SSH tunnel is started and prints into the log for you. The sleep 10 makes the tunnel wait for 10 seconds after all traffic finishes before closing.
PingMaxMsec -> 200
Only set for external (over the Internet) hosts

Schedule

BlackoutPeriods
hourEnd and hourBegin adjusted for user

Client Testing

You can test backups for each client by running the following where hostname is the name of the host in the BackupPC global settings.

/usr/share/backuppc/bin/BackupPC_dump -f -v hostname

Web Access and Email Configuration
Client Web Access

You need to set a password for each email address/username you defined previously so users can access their backup pages. Run the following for each host where client email is the email address/username you defined for that host.

htpasswd /etc/backuppc/htpasswd clientemail

To schedule checks for BackupPC status, use cron (see this site for more info). Run

crontab -e

and add the following line to get a message every half hour if the BackupPC server goes down:

*/30 * * * * /usr/share/backuppc/bin/BackupPC_sendEmail -c

If you want to send your email using the message submit port (587) instead of smtp (25), see this post. This will allow you to get around the port 25 blocks some ISPs use to reduce spam on their networks.
Separate Hard Drive for the Pool (Optional)

You probably want to use a separate hard drive or group of drives for your BackupPC pool for easier maintenance, expansion, and reliability. We are going to use Logical Volume Manager (LVM) to create a resizable pool we can easily add more drives to.
Setup LVM

LVM allows us to create expandable logical volumes across many drives. See A Beginner’s Guide To LVM for more detailed setup instructions. Also check out Managing Disk Space with LVM and A simple introduction to working with LVM.

Set up your drive using fdisk. The command below is for a drive at /dev/sdb

fdisk -l
fdisk /dev/sdb

The choices you want to make are: n, p, 1, ENTER, ENTER, t, 1, L, 8e, w. Then run

pvcreate /dev/sdb1
pvdisplay
vgcreate bpcfs /dev/sdb1
vgdisplay
vgscan
lvcreate –name bpclv –extents 100%FREE bpcvg
lvdisplay
lvscan
mkfs.ext3 /deb/bpcvg/bpclv

If you get a ‘no entry for device-mapper found’ error, run

modprobe dm-mod

Change the Archive Directory

See here for more info. If your new partition is /dev/bpcvg/bpclv, execute the following commands as root

mount /dev/bpcvg/bpclv /mnt
cp -dpR /var/lib/backuppc/. /mnt
umount /dev/md0
mv /var/lib/backuppc /var/lib/backuppc.orig
mkdir /var/lib/backuppc
mount /dev/bpcvg/bpclv /var/lib/backuppc
df -h
This makes a backup of your data then copies it to the new drive. Once you’re sure that worked, you need to make it mount on startup. Edit /etc/fstab and add the following line:
/dev/bpcvg/bpclv /var/lib/backuppc ext3 rw,noatime 0 0
Then restart and run
df -h
to make sure it worked.

Installing FreeNAS 0.8 on Oracle VirtualBox 4.1

As part of creating a Windows 2008 R2 cluster there is a requirement to have iSCSI storage or block storage for the Quorum and other shared storage for the cluster. An easy and affordable way to achieve this is FreeNAS. To keep my development cluster all virtual I found the need to create a FreeNAS instance. In this post I will attempt to share how I was able to achieve the desired results.

The Environment

  • Host: Fedora 16 64 bit
  • 4 GB RAM
  • Oracle VirtualBox 4.1.8

First download the appropriate FreeNAS iso from FreeNAS Sourceforge.

Open VirtualBox and click on New. Give the VM a name and select Operating System > BSD and Version > FreeBSD or FreeBSD (64 bit)click next to continue.

Allocate memory size for the VM. Default value will show 128 MB, I would set it either for 256 MB or 512 MB. For this installation I have chosen 512 MB. Click next when you have made your change.

Now we create the virtual hard disk. The default will appear as 2 GB, this will work well for the OS installation. Click next to appect and move along.

The virtual disk wizard will start and you will be presented with several option. The defaul VDI (VirtualBox Disk Image) will work. Click next to accept.

Accept the default of Dynamically allocated storage and click next.

Accept the default for the name for the disk, this will typically be what you set the name of the VM to.

At last the Summary page will appear. Click finish to create the VM.

Once the wizard has completed we will be back at the VirtualBox Management screen and we can move on to installing FreeNAS.

Start the new VM and the first time wizard will appear, click next.

For  the installation media we will need to select the install ISO downloaded earlier. Once selected click next.

Click Start when ready to boot the new vm. elect the default to install FreeNAS.

Select the hard disk to install and press OK.

Press yes to start the installation.

After the installation has been completed you will be prompted to reboot and disconnect the CD-ROM media. Remove the iso file and reboot.

FreeNAS will start and you will be left at an option screen for further configuration.

At this point we need to add a network interface and configure a static ip to FreeNAS. Select option 1 (Configure Network Interface)

Eneter in the following responses:
Select and interface: 1
Delete existing config? (y/n): n
Configure interface for DHCP? (y/n): n
Configure IPV4? (y/n) y
Interface name: lan1  (note: Make this whatever you like)
IPV4 Address: Type in you ip and subnet mask here. I used a class C non routable address (192.168.1.10/24)
Configure IPV6?: n

Now, FreeNAS 0.8 is ready to connect via web browser, make sure your client PC can ping to virtual machine’s new IP. You may have to change the network adapter setting on your VM.

Open your browser of choice and type in the ip address of your running FreeNAS instance and you will be prompted for the admin id and password (freenas by default)

After successful login you will enter into the FreeNAS interface and ready to add storage and configure.

Look for future posts on adding storage and making available for clusters!!

 

Enable Virtualization on Dell Optiplex 755 to run Oracle VirtualBox 4

Recently I ran into an issue when working on creating a test cluster environment for Windows 2008 R2 with Oracle VirtualBox running on Fedora 16 64 bit on a Dell Optiplex 755.

The issue was VirtualBox would complain about VT-x/AMD-V not being enabled and would stop the VM from loading. After doing some digging around found that there is a specific setting in the BIOS to enable what is needed to enable the settings for 64 bit  VM’s to run. These changes will also work in enabling Hyper-V to run properly on Windows systems.

To fix this, boot the computer and press F2 to enter the BIOS.

In the BIOS you need to change the following settings

Security > Execute Disable (set to On)
Performance > Virtualization (set to On)
Performance > VT for Direct I/O Access (set to On)
Performance > Trusted Execution (set to Off)

Save and exit the BIOS, then power the computer down. it is important that the system be powered down.

After the system was powered up, the VM started properly with 64 bit support.

Silicondust HDHomeRun Dual

As a longtime TV card / capture user I am always looking for new products that are easy to use and work well on many OS’s. One that I have wanted to try is Silicondust’s HDHomeRun series. After much reading I decided on HDHomeRun Dual.

According to SiliconDust the HDHomeRun is a TV tuner for computers – Ethernet attached. Once connected to your home router you can access the HDHomeRun Tuners from any computer, anywhere in your home. Watch / Record TV from you Family Room / Kitchen / Garage / Backyard, anywhere you have a computer.

The HDHomeRun streams the full-quality digital stream from the broadcaster or cable provider, ensuring that you get the highest quality possible, including 720p and 1080i HDTV when available.

Now that we have the details, which are pretty impressive, let’s get to it. Included in the package is the following:

  • Ethernet Cable
  • Coaxial Cable
  • Power Adapter
  • HDHomeRun Dual
  • Installation CD
  • Quick Start Guide

Installation couldn’t be easier. Since it is a standalone device there is nothing to connect to your PC.

  • Connect your coaxial cable to your cable provider or your antenna
  • Connect Ethernet Cable
  • Connect the power adapter
  • Insert the CD and run the installation CD and follow the wizard

The setup wizard started and checked the internet for updated software and firmware and downloaded. Once the update was installed the wizard started again and I was asked for my zip code and moved along the process. The wizard was smart enough to see I was running cable and set the source to digital cable. Next the wizard ran a channel scan and the wizard was completed and data was saved.

Now at this point I can watch TV using the HDHomeRun QuickTV app, which I quickly fired up and ran into the only hiccup which is not the device’s fault but a Windows issue. I had video but no audio, which upon checking the forum I found that the issue is due to being optimized for Windows Media Player. The issue was quickly resolved by installing AC3filter.

The picture was perfect thanks to HD and better than I have had in the past with older Hauppauge WinTV PVR cards. To go further I followed the instructions for Windows Media Center and quickly was able to have TV guides and recording capabilities with minmal effort.

I was able to repeat this on two other PC’s with no issues and can happily watch and record HD TV on any of them at the sametime.

I would highly recommend purchasing HDHomeRun Dual if you want the ability to watch / record HDTV on your computers on your network or just on your PC. The price was right and the picture is fantastic.

 

Disable Guest Logins for Alfresco 3.4 Community Edition

Recently after installing Alfresco Community Edition 3.4.d found that guests could login by default to the site. Since the site was put up for documentation with restricted access, this was an issue, but only for a short time.

Edit the <installation_directory>/tomcat/shared/classes/alfresco-global.properties file and add the line alfresco.authentication.allowGuestLogin=false and save the file. Restart Alfresco and upon connecting to Alfresco explorer you will now be prompted for login.

Switch to our mobile site