Automated transfers mechanism

software development

#1

I have a computer system at home that creates data files 24/7 on a random basis. I would like this data once created to be automatically uploaded to dreamhost, and after uploaded a script run on the dreamhost to add metadata to a sql database.
anyideas on what transfer protocol to use? ftp scp? i want to make it sure but also automated so i dont have to type in passwords every time it transfers. how could dreamhost know when to run the script when this happens?
im open to any suggestions or ideas…
thanks


#2

Two options come immediately to my mind.

In the first option, your computer system at home would need to take two steps. First, it would upload a file to Dreamhost using ftp/sftp/scp/whatever. Second, using SSH, it would log into the shell and execute some command to invoke whatever script you want it to run. SFTP and SSH allow for “passwordless” login through the use of public and private keys, so you don’t need to worry about that.

In the second option, you create a CGI script to receive the file, put it where it needs to go, and and run whatever database updates you want. On your home computer, what you would need to do is send the file to the CGI script using an HTTP POST request (just like your browser does when you submit a form). Since you write the CGI script, it would be up to you to determine what sort of security control is appropriate; I would suggest a password that you automatically send along with the file created on your home computer so that you know only your computer is allowed to upload files.


#3

COOL
thanks for giving me some ideas…
im gonna get started now


#4

There are quite a few solutions depending on your system.

What Operating System are your files created on and what sort of files are they? Text, Comma Delimited or SQL.

If you have a recent Windows machine you could use Fling. to automatically post your file to your DreamHost account.

Once there you could use ‘Cron’ to run a short PHP script to connect to your local MySQL database and then use a command like ‘LOAD DATA LOCAL INFILE ‘path to external file’ INTO TABLE table_name’ to load the data from your uploaded file into your database.

You may get some more ideas by using Google to search for uploading automatically to a mysql database.


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK! :@

Act on my advice at your own risk!


#5

i ran into a weird problem, wondering if anyone has experienced the same thing.
i decided to go with the public private keys / scp method. seems to work fine except the time stamp on the file on dream host after it is transfered it 1 hour ahead of time!! i tried the -p option with scp still the same… anyone got a idea?