copy file from unix system to windows using ant - ant

can any one help me
how to copy file from unix Windoes system to windows UNIX using ant?
Thanks in advance
EDIT
Let me explain in detail what I am looking for I want to copy file from windows to unix machine (correcting my previous question not from unix to windows) using ANT. I thought of using ftp task.
Before that as a check I tried to ftp unix sever from windows but it gave connection refused error(Do I need to provide my username and password,if that is the case what is the syntax).
But I am able to connect through putty which asks for my user name and password. Does putty uses a different protocol.
So if that is the case does ftp task works for me in ANT?. If not what task I need to use?

You have a couple of options.
If you have a windows shared drive mounted on your windows you can simply use the task.
<copy>
http://ant.apache.org/manual/Tasks/copy.html
If you don't you'll need to set up some service in the Windows side, probably FTP, if that's the case you'll need to use the task:
<ftp>
http://ant.apache.org/manual/Tasks/ftp.html
EDIT
As per your comment, this is all you need:
http://ant.apache.org/manual/Tasks/ftp.html
Take a look at your server ( UNIX ) FTP configuration, compare it with the one you're using in putty.
The protocol should be the same, but unless you give us your FTP server IP + User/Password we won't be able to test it for you.
The link I posted has the needed configuration and examples on how to connect to an UNIX server using FTP. Just, try it.

Probably the simplest option (if you are going from Windows -> Unix) is the Ant SCP task (which will use the same underlying type of connection PuTTY uses -- SSH). See the Ant SCP Task for details. Note that this will require that you have JSch here.

ant scp task can be set up to use passwordless ssh if you set it up with an appropriate key file.
So first make sure you can ssh to the windos server without putting your password into the shell. here is a good set of tutorial for doing it unix to unix http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html . Haven't tried setting up a windows machine, so not too sure how that would work though.
<scp file="file.zip" dir="${userid}#${server}:${remotedir}" keyfile="${env.HOME}/.ssh/id_rsa" passphrase=""/>

Related

Test access to WindRiver/VxWorks license server?

I'm having trouble debugging a WindRiver build system where the build machine seems unable to obtain a license from the WindRiver license server. Is there a tool that allows me to run a "get me a license" check without having to run a complete build?
you can try on the client side, to run from the command line the command -lmutil stat, this will ping the license server and return a response.
regards.
Paul, in this case, if you're using another machine as a license server, first be sure that the server is up and running, after that on the client machine, set the environment variable WRSD_LICENSE_FILE = 27000# and test.

Running an Ant script to prepare a Database in Bluemix

I have an Ant script that I use to populate/prepare a database. All I need is to set the host, port and credentials for the database. It works fine for MySQL and DB2, the DB just need to be reachable from were the script is executed.
The DB service in Bluemix gives me a DB with an IP (75.x.x.x) that is only reachable from the internal network of Bluemix, it is not accessible externally.
My understanding is that my ant script needs to be executed from inside the Bluemix network/servers.
How can I do that?
What would be the alternatives?
I'm considering to create a NodeJS script to trigger that ant internally, but I'm not sure if it will work properly.
dashDB always had the ability for local clients (outside of Bluemix) to connect to the cloud database, and SQL Database later added the feature as well. So you should be able to populate a database as long as you have the correct driver client installed on your local machine.
Can you provide more details on how you tested that the IP is not reachable? Is there a firewall put in place between your local machine and Bluemix? Note that ping is not a good test because the port is blocked for security reasons. You may try the JDBC port indicated on the connection page from the console.
See link for instructions on how to make a connection:
https://www.ng.bluemix.net/docs/#services/SQLDB/index.html#connecting-to-sqldb
You might be able to use a simple custom buildpack. You can start with a sample like this one:
https://github.com/dmikusa-pivotal/cf-test-buildpack
fork it and modify the bin/compile script to run your ant task instead. Then put your ant script (and probably executable as I expect it is not installed in the Bluemix environment) in a directory and run
cf push <appname> -b <your forked git url>
To push it to Bluemix and run it. If you're just using it once you can probably get away with hard-coding the address and credentials, or else you can bind to the same service instance and get the info from VCAP_SERVICES.

Executing script on a UNIX server from PowerShell

I have a PowerShell script hosted in Windows Server 2008 R2. This script need to invoke a UNIX script residing in a UNIX server. After completion of execution of script it must return the output to the calling script. (PowerShell Script). I am implementing it in highly secured servers. Hence cannot use third party built tools/Libraries unless they are authenticated and approved by standards. If there is any standard library which I can make use of and accomplish this task will be appreciated.
There is no "native" way to do it that I'm aware of.
The most secure method I can think of offhand which will be accepted by your review board is to use ssh with keys for authentication. Yes, you'll have to acquire & install an SSH client for Windows, but if your servers are "highly secured" then your security people should be very happy to hear that you want to use SSH. SSH should already be running on the UNIX servers.
You can use ssh to execute any command on the remote system (that you're authorized to execute) instead of creating a login shell simply by appending the command to the end of the ssh command line (as described by the link above).

Finding Informix DB Server

I have a server and I know that there is an Informix installed on it, but I don't know who installed it. There is closed source client connecting to this server but I cannot get anything about it apart from username and password. I have no idea how to connect it, I don't know what would be the port number and server name of it. I have downloaded SQuirreL with JDBC Informix drivers.
How can I connect to JDBC Informix server without knowing the port and server name?
In short, you will need the port number, server name (and database name as well) to connect to Informix.
Assuming that you have permissions to hunt around on the box where Informix is installed, there are a few places where the details about your Informix server are likely to be found. Since I don't see any details as to the platform on which IDS (Informix) is installed in your case, I'll try to provide info for both Unix and Windows platforms. But first, a bit of background:
There are not too many parameters needed to set up a connection to Informix. Typically, all you would need are:
username
password
Server IP Address
Port
Server Name (the name of the Informix instance)
Database Name (the name of the db on [Server Name] to which you want to connect)
It sounds like you need to find out the last three.
Linux:
On a Linux platform (as well as Windows, I believe), there are environment variables that point the way to where on your system Informix is installed. The most important of these is %INFORMIXDIR%, which points to the root directory of your Informix installation. A lot of the time however, Informix is installed in /opt, so try there.
In %INFORMIXDIR%/etc on typical installs is a file called sqlhosts (it may have a suffix for your specific server instance, but it'll start with sqlhosts). In this file is the server name, and possibly the port number. %INFORMIXDIR%/etc/sqlhosts contains plaintext data in the following format:
ServerName NetType HostName Port/ServicesName
The first value is the server name you seek. The fourth value (Port/ServicesName) is either the port number, or the name of the entry in /etc/services which references the port number. If you don't see a port number, look in /etc/services.
For example, sqlhosts will probably contain something like this:
myservername onsoctcp informix.mydomain.com 12345
In this case, your server name is "myservername" and the port is 12345
Alternatively, it could look like this:
myservername onsoctcp informix.mydomain.com informixservice
in which case you would have to go look in /etc/services for a line that says
informixservice 12345/tcp
which will tell you the port.
Windows
Caveat: I've never dealt with Informix servers installed on Windows, however based on the IBM documentation, it doesn't seem much different in regards to the task at hand.
Instead of the file %INFORMIXDIR/etc/sqlhosts, the information you seek is contained in the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\INFORMIX\SQLHOSTS
Use regedit.exe to read the values stored in this entry.
If you don't find a port number in that reg key, the Windows equivalent of Unix's /etc/services file is
C:\Windows\System32\drivers\etc\services
Examine this file with a text editor (notepad works fine).
Hopefully this helps. Good luck.
*Short answer: You can not .*
This kind of situation involves security issues , so , the database doesn't "publish" it self at your network for everyone knows it's there.
If you need discovery without contact the administrator of your (your?) environment, will need to use hackers techniques (nmap utility already help here) to discover some informations (IP, Port) and you still missing informations like servername, protocol ,username and password.
Just caution, because attempt of connection at Informix database listener will be logged.
Now, if you have access at the server where the database is you can look for sqlhosts file and get all this.
Another alternative, more reasonable is just ask to your DBA/Admin the configurations justifying why you want the access.
You CAN find servers on a host:
onstat -g dis
will listed servers even if they are offline (or potentially decommissioned).
Server information is in /INFORMIXTMP on UNIX/Linux and I would expect a simlar folder under C:\ in Windows.
You should add more information about working environment: what platform your client is, what platform your server is, do you have access to server machine etc.
If you know that something from your computer connects to other machine then you can use netstat to discover it. If you work on Linux then there is -p option that shows pid and application name to each connection.
At first we have to discover pid of closed source client:
[root#test1 ~]# ps aux | grep my_app
root 12457 0.0 3.2 3342440 333336 ? Sl Mar06 21:01 java -cp /usr/local/bin/my_app...
Now when I know pid I can use netstat:
[root#test1 ~]# netstat -tnp | grep 12457
tcp 0 0 ::ffff:169.0.1.71:55850 ::ffff:169.0.1.74:9088 ESTABLISHED 12457/java
From this output I can see that Infomix probably works on port 9088 of 169.0.1.74 machine.
On Windows you can use TCPView from SysInternals to see similar things.
On Windows you can also check ODBC Data Source Administrator (both 32 and 64 bit) to see if there is Informix driver in use.

Remote SubversionSVN connection to Unix Server

Having installed TurtoiseSVN locally (local repository, no server) for my Delphi projects, i now want to share my updates via internet. To make it possible i did install Subversion (version 1.6) on an Apache Unix server (RedHat, VDS Hosting plan with Sphera) and created a repository folder at that place. The server is running well but i'm a bit lost at that point:
What are my best options to import the projects to the Unix repository, the easiest will be to clone the local repository to the one on the Unix machine? - ideally i would like them both synchro. What is the best tool to manage the Unix Subversion server and its repository (right now i'm using SSH Explorer) and best tool to checkout/import/export files on the repository of that server?
Tx
To copy the local repository to the server, you can use svnadmin dump to backup the local repo including all revisions to a portable backup file. On the target server, use svnadmin load to install the backup.
See 'Repository Maintenance - Migrating Repository Data Elsewhere' in the documentation.
If you have the server running, there is no need for the local repository anymore. If you really want to keep and synchronize a local repository with the server, you can use the svnadmin hotcopy command.
I have found a solution to my problem.
General remote connection script from a Windows SubversionSVN to a unix Subversion server:
svn+ssh://<username>#<hostname>:<port>/<location of the SVN repository>
Better, lets have username and password parameters added to TortoisePlink.exe, Open Explorer file window, right-click in the file section (get a pop-up), choose: TortoiseSVN -> Settings -> "Network" Pane-> SSH Client.
exemple: 'TortoiseSVN\bin\TortoisePlink.exe -l username -pw password'
now the connection will be:
svn+ssh://#<hostname>:<port>/<location of the SVN repository> ... no need to add username and no password asked for.

Resources