Apple tv ssh script automation

applescriptautomatorssh

I have a Apple TV 2nd generation that is jailbroken and I run xbmc on it. At times it gets hung or freezes up. At that point, I open up the terminal on my macbook and run this script.
ssh root@apple-tv.local
it asks me the password. I type in alpine
then I run "killall AppleTV"

Is there any way to make this a one click operation, like a desktop icon that achieves the same result? Maybe an Apple Script or a Automator workflow?
Any ideas please?

Best Answer

you could ssh root@apple-tv.local killall AppleTV, also you might want to change your passwd from the default. As for a icon, you could but the above into a file and name it with a .sh extention, which could then be 'clicked on'.

If you don't want to be prompted for a ssh passwd, set up some ssh keys.

Setting up ssh keys

If you already have a key on your computer, skip to step 2

  1. ssh-keygen -t rsa and follow the the prompts. If you use a passphrase, you'll want to set up ssh-agent.

  2. Copy contents of ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys on the tv.

  3. chmod go-rwx ~/.ssh/authorized_keys

This is just a quick example, check out this wiki for more.