arfore dot com

welcome to the foremind

arfore dot com header image 1

VNC on the AppleTV

December 10th, 2008 · 4 Comments

Over Thanksgiving break I bought an Apple TV.  Like any good geek I wanted to expand the capability of the unit beyond the default setup.

After installing Firefox and getting USB keyboard and mouse support going, I realized that it would be tremendously cool if I could control it from my iPhone instead of using a wired keyboard.

To begin with I installed OSXvnc.  The only problem was that I needed to store a password.  After reading a the VNC post on the aTV Flash forum, I successfully conquered that.  However, I had the same problem that iMattUK had: you had to use an ssh connection to start it.

To conquer this I wrote a launchd plist to launch OSXvnc for me at system startup.  Below is the process I used to get it all working.

Install OSXvnc

  1. Download Vine Server (OSXvnc).
  2. SFTP/FTP/SCP Vine Server.app to the Documents directory in /Users/frontrow/ on the Apple TV.
  3. SSH to the Apple TV and run the following commands:
    1. cd Documents
    2. cd Vine\ Server.app
    3. ./storepasswd YOURPASSWORD /Users/frontrow/vncpasswd
    4. cp Contents/Resources/OSXvnc-server /Users/frontrow/Applications

Setup Autostart

This next part is a little complicated if you haven’t done it before.  On OS X 10.4 Apple did away with the traditional Unix methods of starting daemons at system start.  The new method they implemented is called launchd.

What you need to do is to create a launchd plist to start the VNC server.  Since vi is not included on the Apple TV you will need to create this file on your computer and upload it.

Here’s the meaty content of my launchd plist:

<key>Label</key>
<string>com.arfore.VNC</string>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Users/frontrow/Applications/OSXvnc-server</string>
<string>-protocol</string>
<string>3.3</string>
<string>-rendezvous</string>
<string>Y</string>
<string>-rfbauth</string>
<string>/Users/frontrow/vncpasswd</string>
</array>

Here’s the entire plist:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>com.arfore.VNC</string>
<key>OnDemand</key>
<false/>
<key>RunAtLoad</key>
<true />
<key>ProgramArguments</key>
<array>
<string>/Users/frontrow/Applications/OSXvnc-server</string>
<string>-protocol</string>
<string>3.3</string>
<string>-rendezvous</string>
<string>Y</string>
<string>-rfbauth</string>
<string>/Users/frontrow/vncpasswd</string>
</array>
</dict>
</plist>

Download the plist here.

Here’s how to put it in place:

  1. Take the text above and save it in a file called com.OSXvnc.plist
  2. SFTP/FTP/SCP the file to the Documents directory in /Users/frontrow/ on the Apple TV
  3. SSH into the Apple TV and run the following commands:
    1. sudo cp /Users/frontrow/com.OSXvnc.plist /System/Library/LaunchDaemons/
    2. sudo reboot

At this point your Apple TV will be rebooted.  After it comes back up use the VNC viewer of your choice to connect to AppleTV.local on port 5900.  You should see the screen.

This is not really useful to control the FrontRow interface, but it works great to control Firefox or EyeTV.

Thanks to iMattUK for the tip on storing the password for OSXvnc-server.

Update (2008-12-17): The problem that was plaguing Bill has to do with the difference between the filesystem view when using FTP vs. SFTP.  When logging in via FTP you don’t actually get access to the whole filesystem.  In order to access the /System/Library/LaunchDaemons/ directory you have to use SFTP.

→ 4 CommentsTags: Apple TV

Migrating WordPress

November 17th, 2008 · No Comments

As some of you might have noticed, I have just recently moved my WordPress installation into a subdirectory of arfore.com.

There are several reasons for this, the main one being that I would like for my blog to become a component of my website rather than the blog being the entire site.

Moving the WordPress installation itself was quite simple, and there are many pages out there describing the process as well as the pitfalls of doing it incorrectly, so I won’t repeat them here.

What was less easy to find was the proper changes to put in the .htaccess file to ensure that any existing links would get redirected to the proper location in the moved WordPress setup.

I have my permalinks configured to create a URL like follows:

http://arfore.com/blog/2008/10/12/foo-bar-baz/

In order to add the subdirectory blog to the front of the URL I used the following rule in my .htaccess file:

RewriteRule ^([0-9](.*))$ http://arfore.com/blog/$1 [R=301,L]

Similarly, to redirect the categories I used the following:

RewriteRule ^category/(.*)$ http://arfore.com/blog/category/$1 [R=301,L]

Now this may not be the most correct method to accomplish the goal, so if it needs correcting by all means let me know.

→ No CommentsTags: arfore.com

Checking OS X services using Nagios

November 7th, 2008 · No Comments

My last two posts, Starting NRPE via launchd and Nagios NRPE on OS X Server 10.5, concerned getting NRPE to run on OS X Server 10.5 and having it startup at system boot.

However, this is only part of the battle.  Once you have Nagios monitoring setup on your server you also need to have some nice options for checking the availability of your running services.

Tim Wilson from the Savvy Technologist, wrote an NRPE plugin that helps out with this.  The plugin check_osx_services does an excellent job of checking on the status for many services running on 10.5 Server.

The documentation on the plugin at the NagiosExchange site is pretty thorough.  One thing that is not mentioned is that you will need to run the check_osx_services script as superuser since it calls the system level command serveradmin which must be run as root.

→ No CommentsTags: Mac OS X Server · Nagios · Software

Starting NRPE via launchd

October 12th, 2008 · 4 Comments

Last week I posted on how to setup NRPE on Mac OS X Server.  Here is what you need to do to make it start up at system boot.

On a Linux or Solaris machine you can just include the call to the daemon in an init script like rc.local and it will be started when the OS boots.  Unfortunately, Apple has made this a little more difficult on Mac OS X with Tiger and Leopard.  The standard startup processes (cron, inetd, xinetd, etc.) have been rolled into a single process known as launchd.

[Read more →]

→ 4 CommentsTags: Mac OS X Server · Nagios

Nagios NRPE on OS X Server 10.5

September 25th, 2008 · 4 Comments

Recently I was tasked to install the Nagios add-on NRPE on two OS X 10.5 servers.

I read a little on the ‘net about it, but no one actually had much in the way of a walkthrough, so I thought I would fill the void.

The basic steps involve compiling the NRPE source, but doing so involves altering some of the code.

[Read more →]

→ 4 CommentsTags: Mac OS X Server · Nagios