How can I open a remote ssh session with perl

2010-08-24 Thread S Pratap Singh
Hello , I want to open a remote ssh session using the perl script , I am able to login to the server using the simple script and i am also able to execute few commands which is defined in the script on the server. I am writing a script which takes the user name , password and hostname from the d

Re: How can I open a remote ssh session with perl

2010-08-25 Thread S Pratap Singh
Here is my code which logs in and performs some task but it does not show the output of top and pstree command what would i do to get the output of these commands along with vmstat and iostat #!/usr/bin/perl -w use Net::SSH::Perl $host = '192.168.3.36'; $username = 'root'; $login_passwd = 'passwor

Re: How can I open a remote ssh session with perl

2010-08-26 Thread S Pratap Singh
> Hello , > Thanks Shlomi for valuable giving input on my code I will implement that > too. > > But still my question remains same is it possible to open a remote session > with perl and get the output of "top", "vmsate 1 10", "iostat 1" , "yum > install etc", etc .. > > > I am not getting the outp

Re: How can I open a remote ssh session with perl

2010-08-26 Thread S Pratap Singh
Hello Peter , Did you try executing command "top -cd2", "iostat 1", vmstat 1 10" etc ? Did you get the output of those command ? I am not getting the output of these commands rest works fine for me . Pstree, I am getting partial output Here is the output at my end of pstree command ===

Re: How can I open a remote ssh session with perl

2010-08-27 Thread S Pratap Singh
Hello , Is there any way I can get these interactive output via my script or I am missing something? .. Thanks for your continued help. I need to get those interactive outputs to my script or is there any way to open a psuedo terminal. I do not want to execute command on server it should be exam

Re: How can I open a remote ssh session with perl

2010-09-02 Thread S Pratap Singh
This code(given below) is working fine for all the command but for some command it is not able to print the output. I am getting the following output == w 52 column window is too narrow == Similarly for top it is not printing all the field . top -cd2 top - 20:36:28

Re: How can I open a remote ssh session with perl

2010-09-09 Thread S Pratap Singh
I am stuck with this issue does any one have any idea about this ... This code(given below) is working fine for all the command but for some command it is not able to print the output. I am getting the following output == w 52 column window is too narrow Output of the same comm

How to parse email header

2010-10-12 Thread S Pratap Singh
Hello , I am trying to write a script which can parse email header and based on certain criteria/parameter it will update the email subject detail in the database. I have written a code but it is taking too much time to execute the code and each process is utilizing 100% of its cpu resources allo

Re: How to parse email header

2010-10-12 Thread S Pratap Singh
Here it is Return-path: Envelope-to: sea...@example.com Delivery-date: Sat, 14 Aug 2010 18:08:06 -0700 Received: from localhost.localdomain ([127.0.0.1]:58763 helo=[192.168.0.122]) by server.example.com with esmtpa (Exim 4.69) (envelope-from ) id 1OkRhm-000

Re: How to parse email header

2010-10-14 Thread S Pratap Singh
I got the problem fixed by using Mail::Header perl module and it is better than before. Thanks for all your inputs , really appreciated. Rregards, Pratap

PERL MYSQL query "IF EXISTS then UPDATE else INSERT"

2010-10-19 Thread S Pratap Singh
Hello, I want to update my database if the key value is already there then it will update the required field else it will insert the new row in the same table. Insert query works fine but I am not able to figure out how to achieve this "IF EXISTS then UPDATE else INSERT" using a one liner MYSQL

Merge two files with similar column entries

2012-04-08 Thread S Pratap Singh
Hi , I have few files which contains user name and data transfer rate in MBs and this data is collected for year and for each month report is saved in 12 different files I have to merge all the files to prepare the final report Files are as below Filename1 : January #User Name #Data