Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

guybowden

macrumors newbie
Original poster
Apr 7, 2009
1
0
Hi,

I'm trying to set up a way to automatically upload my nzb files to the watch folder on the ATV - I've got a shellscript that works fine when run in the terminal, but no so when it runs via cron...

Any tips or advice would be great!

first script:
tars up all my new nzb files and runs the scp and ssh shell scripts:


Code:
#!/bin/sh
cd /Users/guy/Downloads
/sw/bin/tar -cf nzb.tar *.nzb

/Users/guy/Code/shellscripts/scp.sh
sleep 5
/Users/guy/Code/shellscripts/ssh.sh

rm nzb.tar
rm *.nzb

Then scp.sh - uploads the tar to the ATV
Code:
#!/usr/bin/expect -f
cd /Users/guy/Downloads
spawn /usr/bin/scp nzb.tar frontrow@appletv.local:Downloads/nzb
expect -re ".*sword.*"
send "frontrow\r"
interact

Then ssh.sh - untars the uploaded tar file - and deletes it off the ATV
Code:
#!/usr/bin/expect -f

spawn /usr/bin/ssh frontrow@appletv.local
#######################
expect -re ".*sword.*"
send "frontrow\r"
sleep 1
expect -re ".*$.*"
send "cd ~/Downloads/nzb\r"
sleep 1
expect -re ".*$.*"
send "tar -xvf nzb.tar\r"
sleep 1
expect -re ".*$.*"
send "rm nzb.tar\r"
sleep 1
expect -re ".*$.*"
send "exit\r"
interact

As I said - this runs fine in the terminal window, just not as a cron job....
 
MacOSX doesn't use the cron mechanism at all. You have to suffice with the new launchd.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.