Warning: Creating default object from empty value in /home/mirandam/public_html/linux/wp-includes/functions.php on line 292
Fedora, Linux and Stuff :: Automated FTP Script

Automated FTP Script

Monday, October 11th, 2010 ~ 1:17 pm by Mauriat Miranda

I’ve been doing some development for some embedded Linux devices which only support ftp and telnet. In order to automate transfer of binaries from my Fedora development host to the target embedded device I’m using this handy ftp script: pushftp.sh

# arg1 = dest hostname
# arg2 = local file
# arg3 = dest dir
ftp -inv $HOST<<ENDFTP
chmod 755 $SRCFILE

Then I added something like this to my Makefile after cross-compiling:

        sh ~/bin/pushftp.sh $(TEST_BOX) $(APP_BIN) /usr/local/data

So after I run make all, I run make push. I still need to telnet to the host to test/debug the application, but this makes the process much faster (and less error-prone).

I’m just noting this for myself, hopefully it’s useful to someone else.

One Response to “Automated FTP Script”

  1. Rob Russell Says:

    Nice, but have you considered making a local mirror of the remote file structure which consists of empty files that get touched after the corresponding data is delivered by ftp? Then you could send only files that have changed since the last build.

    If the push target is fast enough (and does nothing when no files have changed) then you could run make push every couple seconds in a background script while you’re developing. I had to do something similar for some PHP development a while ago, but I only had a couple files so I didn’t need to generalize it.