#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    0

    Ftp connection using korn script


    hi everyone!please help me..i need a korn shell script that can get and put data in a server using ftp..thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,450
    Rep Power
    1751
    Do you know what the file names are that you will be ftp-ing?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    0
    Originally Posted by SimonJM
    Do you know what the file names are that you will be ftp-ing?


    yeah!some sample files..
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    0
    #!/bin/ksh

    REMOTE='000.000.0.000'
    USER='xxx'
    PASSWORD='xxx'

    source_dir='cd /usr/src'
    target_dir='cd /usr/src'

    ftp -n $REMOTE <<_FTP
    quote USER $USER
    quote PASS $PASSWORD

    bin
    lcd $source_dirpeed
    cd $target_dir

    put sample.txt
    bye
    _FTP
    exit



    error:

    ftp: connect: Connection refused
    Not connected.
    Not connected.
    Not connected.
    Local directory now /root
    Not connected.
    Not connected.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,450
    Rep Power
    1751
    And if you do those steps manually?
    Try changing the user/password lines to be just:
    Code:
    USER $USER $PASSWORD
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    6
    Rep Power
    0
    it is right that the variable in remote is the ip address of the machine that im going to connect?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,450
    Rep Power
    1751
    Yes, the $REMOTE variable in your script should be the IP or hostname of the server you are connecting to.

    Comments on this post

    • aitken325i agrees
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0
    I have script,but its very costly...
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,450
    Rep Power
    1751
    Originally Posted by desiramba
    I have script,but its very costly...
    That's nice
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo