| | #1 |
| Warrior Member War Room Member Join Date: 2010
Posts: 22
Thanks: 0
Thanked 2 Times in 2 Posts
|
Hello, I have to upload two files everyday for a promotion I'm doing. I have to do it at the same time everyday and it's quite annoying and not at the best time for me. Anyway, I was wondering if there was a way to create a cron job so I would put my updated files in a folder and thanks to this cron job they would be transfered in the other directory to replace the "old" files? Thanks to enlighten me. |
| WSO: big Forex ebook with PLR + sales letter $10 only!! Free report: the 7 benefits of seasonal marketing http://bit.ly/e0K2TC | |
| |
| | #2 |
| VIP Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,548
Thanks: 264
Thanked 507 Times in 300 Posts
Blog Entries: 83 |
Cron is not the best method, since it is not the most secure way to do this, I would use SFTP, this can be done using a scripting command, or you could purchase a software product, free, but complex, Senior Advisor - http://www.unix.com There are several software clients, they all seem to run around 85 bucks, not sure why, if you had a MAC you could just script it, Google, AbleFtp also you can try automate FTP or better sFTP |
| Bitcoin | Crypto | AI software tools and development| | |
| |
| | #4 |
| New Warrior Member Join Date: 2006 Location: Crawley South Coast, United Kingdom.
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
|
Hi David, Cron itself wont do the transfer but the script that the Cron job runs can. Do you have any programing experience (PHP etc) ? If so using the php file commands should work to copy the file content from one file and create a new one with it. fopen() fgets() fputs(). See php.net for more. Cheers Chris |
| | |
| |
| | #5 | |
| perl scraper War Room Member Join Date: 2010
Posts: 85
Thanks: 14
Thanked 8 Times in 8 Posts
|
Here is the perl code that will do it: HTML Code: #!/usr/bin/perl
#scp.pl
#kkoechel.net
use strict;
use Net::SCP::Expect;
my @files = qw( index.cgi
work.jpg
whatever.file
);
my &remotelocation = '/path/to/some/directory';
my &user = 'YOURUSERNAME';
my &password = 'YOURPASSWORD';
my &host = 'YOURHOST.senecamedia.com';
my &timeout = 75;
my &scpe = Net::SCP::Expect->new(timeout=>&timeout);
&scpe->login(&user, &password);
foreach my &file(@files){
print "sending &file to &host:~/&owner/&filen";
&scpe->scp(&file,"&host:&remotelocation") if &file;
} Using cron or windows task scheduler is easy to google, and you should to make sure you have the right syntax EDIT: it keeps wiping out my variables, I am guessing some sort of javascript cleaner? EDIT: OK, I replaced all the dollar signs with ampersands, you need to find and replace those back in before this will work. | |
| |
| | #6 |
| Warrior Member War Room Member Join Date: 2010
Posts: 22
Thanks: 0
Thanked 2 Times in 2 Posts
|
Thanks to all of you for your advices and lines of code. I was expecting to be able to do that with a simple Cron job, bad luck for me. I don't want to spend any money for that as I just need to do this operation for 3 weeks. I also don't have any scp access, I'm just using a simple shared hosting account. Ok, I think I will continue to do it by hand. Thank you again. |
| WSO: big Forex ebook with PLR + sales letter $10 only!! Free report: the 7 benefits of seasonal marketing http://bit.ly/e0K2TC | |
| |
| | #7 |
| perl scraper War Room Member Join Date: 2010
Posts: 85
Thanks: 14
Thanked 8 Times in 8 Posts
|
What kind of access do you have? I could rewrite that for just about any logon mechanism
|
| |
| | #8 |
| Warrior Member War Room Member Join Date: 2010
Posts: 22
Thanks: 0
Thanked 2 Times in 2 Posts
| |
| WSO: big Forex ebook with PLR + sales letter $10 only!! Free report: the 7 benefits of seasonal marketing http://bit.ly/e0K2TC | |
| |
| | #9 |
| perl scraper War Room Member Join Date: 2010
Posts: 85
Thanks: 14
Thanked 8 Times in 8 Posts
| |
| |
|
| Bookmarks |
| Tags |
| cron, file, job, replace |
| |