views:

66

answers:

2

We have a set of Mac machines (mostly PPC) that are used for running Java applications for experiments. The applications consist of folders with a bunch of jar files, some documentation, and some shell scripts.

I'd like to be able to push out new version of our experiments to a directory on one Linux server, and then instruct the Macs to update their versions, or retrieve an entire new experiment if they don't yet have it.

../deployment/
../deployment/experiment1/
../deployment/experiment2/

and so on

I'd like to come up with a way to automate the update process. The Macs are not always on, and they have their IP addresses assigned by DHCP, so the server (which has a domain name) can't contact them directly. I imagine that I would need some sort of daemon running full-time on the Macs, pinging the server every minute or so, to find out whether some "experiments have been updated" announcement has been set.

Can anyone think of an efficient way to manage this? Solutions can involve either existing Mac applications, or shell scripts that I can write.

+1  A: 

You might have some success with a simple Subversion setup; if you have the dev tools on your farm of Macs, then they'll already have Subversion installed.

Your script is as simple as running svn up on the deployment directory as often as you want and checking your changes in to the Subversion server from your machine. You can do this without any special setup on the server.

If you don't care about history and a version control system seems too "heavy", the traditional Unix tool for this is called rsync, and there's lots of information on its website.


Perhaps you're looking for a solution that doesn't involve any polling; in that case, maybe you could have a process that runs on each Mac and registers a local network Bonjour service; DNS-SD libraries are probably available for your language of choice, and it's a pretty simple matter to get a list of active machines in this case. I wrote this script in Ruby to find local machines running SSH:

#!/usr/bin/env ruby

require 'rubygems'
require 'dnssd'

handle = DNSSD.browse('_ssh._tcp') do |reply|
  puts "#{reply.name}.#{reply.domain}"
end

sleep 1
handle.stop
Jim Puls
This is a potential solution (and we happen to be using Subversion to manage our source code). However, ideally I wouldn't want to have to physically go to every client machine to run this -- a centralized method would be preferable.
kpozin
Why would you have to go to every client machine? Just have a script on every machine that runs every few minutes from launchd or cron and does the Subversion update.
Jim Puls
A: 

You can use AppleScript remotely if you turn on Remote Events on the client machines. As an example, you can control programs like iTunes remotely.

I'd suggest that you put an update script on your remote machines (AppleScript or otherwise) and then use remote AppleScript to trigger running your update script as needed.

If you update often then Jim Puls idea is a great one. If you'd rather have direct control over when the machines start looking for an update then remote AppleScript is the simplest solution I can think of.

Naaff