Archives / Search ›

Here's how I set up rsync to work automatically from Radio. The problem was in getting SSH authorization to a process executed with sys.unixShellCommand. Radio just executes commands, it doesn't provide any way of connecting standard input. Standard output is returned as the result of the command, and standard error goes to the console log (open Console.app to see it).

Install SSHPassKey. This program will prompt you for a SSH passphrase once, then save it in the Keychain subsequently. It essentially replaces ssh-agent with the Keychain, but it can coexist with ssh-agent. I use both.

I had been using a similar program called SSHAskPassword, but SSHPassKey is better.

The OpenSSH client (ssh) can be configured to use an external password request program with the SSH_ASKPASS environment variable. However, it only does so if the DISPLAY variable is set, and there is no stdin connected. So, from Radio, you can fake the DISPLAY variable like this:

sys.unixShellCommand ("DISPLAY=' ' ~/scripts/sync-weblog.sh")

where the contents of sync-weblog.sh are:

#!/bin/zsh
export SSH_ASKPASS=/Applications/Utilities/SSHPassKey.app/Contents/MacOS/SSHPassKey
export RSYNC_RSH=ssh
rsync -az ~/Sites/sabi.net/log ainaz:web/

If you use SSHPassKey's “configure login environment” option, you don't need to set SSH_ASKPASS, but you still need to set RSYNC_RSH.

One thing I can't seem to do is to get Radio to execute the shell script asynchronously. I don't care about the return value, I just don't want to hang Radio while it's happening. Anyone?

Comments are closed.