FTP Jobs

General
manfeb14
2011-07-19
2013-05-28
  • manfeb14
    manfeb14
    2011-07-19

    <oddjob>
        <job>
            <folder>
                <jobs>
                    <net:ftp host="103.110.121.135" name="SampleFTP" password="RGDERT" username="RGDERT" xmlns:net="http://rgordon.co.uk/oddjob/net">
                        <commands>
                            <net:ftp-get remote="/was/Oddjob/oddjob/Sample_Jobs/JobA.sh"/>
                        </commands>
                    </net:ftp>
                  </jobs>
            </folder>
        </job>
    </oddjob>

    I have some queries.

    In the above configuration, im trying to copy a script file from remote server using net-ftp job.The JobA is copied but to the location where the oddjob bat file (to run oddjob) is present.

    I want the following things to happen.. Pls suggest.

    1. I want the following output job,JobA.sh to be copied to the dir which i want. There is a option called output in net:ftp-get but im not getting the Job copied to the output directly. the output directory is C:\Mark\MTools\FTP-Jobs.

    2.I want to copy a folder from remote (contains a list of files) to a local directory. I tried using <net:ftp-list path="/was/Oddjob/oddjob/Sample_Jobs"/> > it is coming as executed but files are not even copied to the location where the oddjob bat file (to run oddjob) is present.

    I want to copy a file or a folder from remote to a folder of my local(C:\Mark\MTools\FTP-Jobs)..Please suggest.

     
  • Rob Gordon
    Rob Gordon
    2011-07-19

    Hi,

    the file property allows you to specify the local file.

    I haven't implemented directory copies yet. But you can use ant. Here's the Oddjob ant job I use to update the Oddjob web site:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <ant id="ant-ojsite" name="Send the web site files">
        <tasks>
            <xml>
                <tasks>
                    <ftp passive="yes" password="${vars.password}" remotedir="htdocs/projects/oddjob" server="${vars.server}" userid="${vars.user}">
                        <fileset dir="${vars.ojSite}/build/docs"/>
                    </ftp>
                </tasks>
            </xml>
        </tasks>
        <classLoader>
            <url-class-loader>
                <files>
                    <files files="${this.dir}/lib/*.jar"/>
                </files>
                <parent>
                    <value value="${ant-ojsite.class.classLoader}"/>
                </parent>
            </url-class-loader>
        </classLoader>
    </ant>

    Copy the the Ant Dependencies for ftp into the oddjob/oj-ant/lib directory and you don't need the classpath.

    Did the local prompting for a remote job execution solution work?

    Rob.

     
  • manfeb14
    manfeb14
    2011-07-26

    Hi,

        The Local Promting for a remote job worked :).. Sorry for the late reply.. i forgot to reply actually..
    I have a situattion here where i want to do the following.. I am having a Jar (containing list of java class files) on the remote server say "103.110.121.135"  with  username="RGDERT"  and password="RGDERT". i am having some set of class files on my location machine C:\Mark\MTools\FTP-Jobs\*.class.. i want to update the class files from C:\Mark\MTools\FTP-Jobs\*.class. to the remote server say in this path ="/was/Oddjob/oddjob/Sample_Jobs/RGD/*.class….

    I am able to do it using ZIP task of ANT Job if it is local jar … I want to do the same thing on remote.. I have the option of FTP task in ANT but not able to combine the ZIP TAsk with the FTP task….

    Is there any way to combine these two tasks or if not FTP, i just want to connect to the remote server and to that location and do the ZIP task…

    I know i can do a FTP Task first and copy the jar to a location on local  machine and do a ZIP task and again a FTP task to copy the updated jar to remote.. I dont want this because copying from remote to local and then from local to remote will taske a lot of time and i will hv to do for many jars..

    A something like this is wat i want..

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <oddjob>
        <job>
            <folder>
                <jobs>
                    <ant id="ant-ojsite" name="Send the web site files">
                        <tasks>
                            <xml>
                                <tasks>
                                     <xml>
    <tasks>
    <ftp  password="tcg#2011" server="172.20.50.191" userid="kccinst1" />
           <zip destfile="/was/Oddjob/oddjob/Sample_Jobs/FTP_jobs/MCAPPWAR/WEB-INF/lib/GUI_CLD.jar"
    update="true" >
    <fileset dir="C:\Documents and Settings\310401\Desktop\Deliveries" >
    <include name="CLD\*.class" />
    <include name="CLD\HelperBeans\*.class" />
    <include name="CLD\Action\*.class" />
    <include name="CLD\ActionForm\*.class" />
    </fileset>
    </zip>
    </tasks>
    </xml>
                                </tasks>
                            </xml>
                        </tasks>
                    </ant>
                  </jobs>
            </folder>
        </job>
    </oddjob>

    I know this will throw an error .. pls suggest..

     
  • Rob Gordon
    Rob Gordon
    2011-07-28

    Hi - I'm slightly confused by what you're trying to achieve. Doesn't the zip task need to run on the remote machine?

    If you can get what you want to happen using plain old ant you should be able to copy the tasks (what's between the target tags) straight into oddjob.

    Rob.