How can I automate an SFTP file upload to my web server?
-
I want to automatically upload a file via ssh or sftp to a web server whenever it is modified. I used to use an old application called Kung-Tunes to upload a formatted html "recently played" list of songs from iTunes to my web server, but it's abandonware, & doesn't seem to work with ssh, at least on my new hosting service (Nearly Free Speech) I can still generate the file with Kung-Tunes, and I can synchronize the folder with Transmit, but is there a way that I can automate Transmit or another program like it to automatically log in via ssh & transfer the file whenever it is written every 3-5 minutes? Running Mac os 10.5.8 on ppc
-
Answer:
Dropbox has a âPublicâ folder that does do standard web serving. You canât change the URL, but you can (for example) put the page in a frame.
Devils Rancher at Ask.Metafilter.Com Visit the source
Other answers
You can use http://www.expandrive.com/ or another SSHFS system to make your remote SFTP server look like a local disk on your Mac. Then you shouldn't need to do any scripting—just save in the appropriate folder directly.
grouse
https://code.google.com/p/lsyncd/ is what you want if you don't want a dependency on dropbox.
devnull
sounds like a job for applescript.
Mad_Carew
I don't have 10.5.8 (I'm on Mountain Lion), but the following should work: Open Automator Select Folder Action as the new type of Automator script The action you want is called Upload and it is provided by Transmit, fill in the necessary details Set the folder to be the folder that Kung-Tunes dumpts the html file to Profit! (If you don't have Transmit [you did mention it] you can do this just as well with a bash script and ssh keys. If 10.5.8 doesn't have Automator [not sure when it was introduced], you can do this with cron firing a bash script and ssh keys.)
Brian Puccio
Or automator. Automator can set up an action on a folder to do many things, including "Run Shell Script." The shell script can do the ssh/transfer and can delete the file in the action folder so that it can do the next thing on the next generated file. Or, if you're a bash kind of person, you can use the unix utility "rsync" and a cron job that fires every five minutes. Or if you don't want to sync but just want to copy files, use "scp" in an every five minute cron job.
Mad_Carew
I wish I were applescript savvy, but alas, I'm a point & click end-user of the lowest sort. I can read manuals, though. I just tried Automator using the "Get Specified Finder Items" and the "Upload" (Transmit) actions, but it sticks at the "overwrite file?" dialog, and I don't see how to make it run automatically every time the file is modified. I understand the rudiments of the bash command line & rsync, but have never run or written a shell script in my life.
Devils Rancher
assuming the file isn't large enough that you wouldn't mind false positives you could just upload it every minute using cron. A http://hints.macworld.com/article.php?story=2001020700163714. If automatically logging in is an issue you can look into http://micheljansen.org/blog/entry/123
mce
This doesn't answer your direction question, but have you considered using something like Dropbox or another cloud storage platform? That's really the most straight-forward way of keeping files in sync, and it sounds like that's the problem you're trying to solve.
deathpanels
I don't see how to make it run automatically every time the file is modified I expect you could do this with http://www.macworld.com/article/1167157/automate_tasks_with_folder_actions.html
flabdablet
Related Q & A:
- How can I convert UTF-16 file to UTF-8?Best solution by Stack Overflow
- How can I send a .mht file as blat attachment?Best solution by Stack Overflow
- How can I programmatically extract a file quickly and efficiently within Android?Best solution by Stack Overflow
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- How can I forward my Yahoo Mail to my Microsoft Exchange server?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.