This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Is posible?

Help for those learning Tcl or writing their own scripts.
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

juanamores wrote: ...
But , not upload nothing ....
...
Any suggestions ?
This works for me. Runs once daily, via crontab:

Code: Select all

ftp -n -v -p <<EOF
open address.to.open.goes.here
user username_here password_here
ascii
cd HTML
put filename_to_upload_here
close
bye
EOF
You will need to decide if you need the
ascii
command and the
cd
command. You may or may not need them.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

I did it! :mrgreen:
In the end I used this tutorial .
Combining the .netrc file with FTP macros and bash script.
The .ntrc file provides security so that passwords are not stored in plain text.
Then the orders are given by macdef (FTP macros) .
At the end I invoke the macro created with a bash script.

Code: Select all

> Echo " $ updateTxt " | ftp -v ftp.ejemplo.com
.netrc file with macro:

Code: Select all

machine ftp.ejemplo.com
login user_login
password the_user_pass

macdef updateTxt
lcd /home/juan/datas
cd /www/data/txts
put myfile.txt
bye
updata.sh script:

Code: Select all

#!/bin/sh
echo "$ updateTxt" | ftp -v ftp.ejemplo.com
crontab:

Code: Select all

* * * * * /home/juan/datas/updata.sh >/dev/null 2>&1
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Sorry willyw, I had not read your answer.

The upload was made in binary format and it works.
I read that for the .txt files is advisable ascii.
But now that I work properly, I do not want to try anything else.

Did you see the solution I found in the previous answer ?
Thanks to you and caesar for their support .
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
Post Reply