Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote deployment to a unix server using FTP task in ANT

 
Sumit Ranjan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to deploy my tar file on a remote unix server using the FTP task provided by ANT.For doing this I need to connect to a particular unix host and then acquire the superuser status by doing su - username and password as only the superuser has the access to copy any files to the runtime environment.

Presently I am able establish a connection to the remote host with my userid and password but I dont know then how to switch to superuser id and password before trying to deploy my file by copying it to the correct location on the server..???

My target for this deployment looks like this -

<target name="deploy"
depends="create_dam"
description="Deploy the tar file on to the deployment environment">
<ftp
action = "put"
server = "${Server.Address}"
remotedir = "${remote.dir}"
userid = "${user.id}"
password = "${password}">
<!-- here I need some code to become superuser -->

<fileset dir ="${dist.dir}">
<patternset refid="tar.patternset"/>
</fileset>
</ftp>
</target>

Can anyone guide me on the same??
Thanks in advance...
Sumit
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could upload the files to your unix home directory using the ftp task,

and then deploy it from the unix server via the telnet task.
With the telnet task you can execute the su command, and then move the files from your home dir to the deployment dir.

Regards, Jan

(Maybe your ftp server supports the "quote site [command] [parameters]" command?)
 
Sumit Ranjan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could upload the files to your unix home directory using the ftp task,

and then deploy it from the unix server via the telnet task.
With the telnet task you can execute the su command, and then move the files from your home dir to the deployment dir.

Regards, Jan

(Maybe your ftp server supports the "quote site [command] [parameters]" command?)
----------------------------------------------------------------------------

Hi Jan,

First of all thanks a lot for your valuable suggestions.. Using your suggestion I was able to ftp the tar file to my home directory but I still have this doubt as to how to login to a unix host as a superuser using telnet task and then copy the tar file from home directory to the required Server's runtime environment. Can you please give some sort of example for the same if it is possible for you... This is the first time I am dealing with remote deployment of tar files.. so I dont know much..!!!

Thanks a lot in advance,
Sumit
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the telnet task, you can execute any unix command.
Example:

Ask your unix administrator for the command to become a superuser.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic