473,748 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to copy a log file from solaris machine to windows after telnet to that machine?

30 New Member
Hi ,

Is there any command in perl to copy a log file from solaris machine to windows machine after telnet to that machine?
After copying how can we check that log for particular event?

Thanks and Regards,
Susi
Jun 27 '07 #1
3 2390
prn
254 Recognized Expert Contributor
Hi susi,

Check out the modules Net::FTP and (better) Net::SFTP for file transfer.

As far as looking for particular events in a log file, that should be relatively easy. It just depends on looking for whatever in the log file identifies the events. Then there's the question of what to do with the events when you've found them, but that's another question.

HTH,
Paul
Jun 27 '07 #2
susinthaa
30 New Member
Hi,

yes, Actually I want to confirm that whether the event occured or not.
But if I tried that I copied the logfile in an array and i used , pattern matching .
Even though it identifies the error, but execution did not stopped.
Its goes to next line of execution.
I tried the following code.

Expand|Select|Wrap|Line Numbers
  1. print"Choose anyone of the lun name:\n";
  2. @line = $telnet->cmd("disk");
  3. print "@line";
  4. $movie=susintha;
  5. $song=arun;
  6. system ("mkdir -p $movie/$song touch $movie/$song");
  7. open(FILE,">$movie/$song/file.txt");
  8. print FILE @line;
  9. close FILE;
  10.  
  11. print "\nEnter the lun name:\n";
  12. chomp($lunname = <stdin>);
  13.  
  14. open(FILE,"< $movie/$song/file.txt");
  15. #@lines = <LOGFILE>;
  16. foreach $line ( <FILE> ) {
  17.     if($line=~ /$lunname/) {
  18.         $flag=1;
  19.         print"matchs";
  20.     }
  21. }
  22. if ($flag!=1) {
  23.     print"Enter correct lun name";
  24. }
  25. close(FILE);
  26. @vold=$telnet->cmd("disk $lunname stat");
  27. print"@vold";
  28. #print"susintah";
  29. print"\nEnter the Volume name:\n";
  30. chomp($volname =<stdin>);
  31.  
In this if any user give wrong input ,it intimate the user and also give some system errors, and execution goes to next line and asking the user for volume name.

Is there any command to stop the execution if any errors occured.
Any ideas?

Thanks,
Susi
Jun 27 '07 #3
prn
254 Recognized Expert Contributor
yes, Actually I want to confirm that whether the event occured or not.
But if I tried that I copied the logfile in an array and i used , pattern matching .
Even though it identifies the error, but execution did not stopped.
Its goes to next line of execution.
Is this how you are getting a "logfile"? Just capturing the output of a command? That is not a "logfile".
Expand|Select|Wrap|Line Numbers
  1. print"Choose anyone of the lun name:\n";
  2. @line = $telnet->cmd("disk");
  3.  
Why are you bothering to save the array @line to a file? You then just open "file.txt" again and read in the file, which is equivalent to @line. You don't need to do that. Just use @line itself.

The other problem you mentioned is that regardless of what the user enters it just keeps on. Consider something like:
Expand|Select|Wrap|Line Numbers
  1. #! /usr/bin/perl
  2. use strict;
  3.  
  4. my @line = ("lun1", "lun2", "lun3", "lun4", "lun5");
  5. my $flag;
  6. my $lunname;
  7.  
  8. while (! $flag ) {
  9.     print "Choose any of these lun names:\n";
  10.     foreach my $ln (@line) { print "$ln\n"; }
  11.     print "\nEnter a lun name:\n";
  12.     chomp($lunname = <stdin>);
  13.  
  14.     print "lunname entered is $lunname \n";
  15.  
  16.     for (my $i=0; $i<=$#line; $i++) {
  17.         if ( $lunname =~ /$line[$i]/ ) {
  18.             $flag = 1;
  19.             last;
  20.         }
  21.     }
  22. }
  23. print "$lunname is a valid lun\n";
I just defined the array @line for this illustration, but you can see that the "while (! $flag)" construction allows you to loop until the user enters a valid lun name, i.e., one from the list.

(Incidentally, always "use strict", it helps a lot.)

Let us know if this does not answer your question and solve your problem.

Best Regards,
Paul
Jun 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6749
by: Putz Ronald | last post by:
Hy! We got the same datamodell on Solaris and on WindowsXP. But there is a mojor difference in the Performance. The database on Windows is much faster than the one on Solaris although the Solaris machine is a dual processor. The initialization parameters are also correct, I hope so (like db_block_size rtc.). Does anyone have the same problem or know what can be the reason of this performance lack? Solaris Version:
0
2597
by: Tess | last post by:
Hi, Long time reader, first time poster... Any help is appreciated. I have a few questions regarding Winform controls embedded within an html page. For more info please see the appendix. Now, for the questions. 1. A button on my control executes the System.IO.Directory.GetDirectories funtion (the scanned directory resides on the hosting web server). What credentials is this
14
1494
by: is_vlb50 | last post by:
Hi! I want to develop and compile the code on windows OS(winXP) .And after this just to copy binaries to Sun Solaris.Is it possible and how to do it?Which tools I can use? Thanks
1
3030
by: james2 | last post by:
I am trying to write a perl script that will do remote machine. I have done user loging using simple command; $telnet->login('test', 'test123'); But now I want to do root login or superuser login. So I tried the superuser command, $telnet->cmd("su"); But I am not able to send the password , like,
7
14136
by: ajays | last post by:
I have a situation where i have to execute a Batch script on Remote Windows Machine (MACH2) from my local machine (MACH1). I was able to do this from windows machine to Linux machine but not able to do this from windows machine to windows machine. Because when i coonect to windows machine MACH1 to anothe windows machine MACH2 using telnet , it ask for a (y/n) from the user , which i'm not able to provide in script (written below ) ...
3
5781
by: susinthaa | last post by:
Hi , I wrote one program in perl in Solaris to telnet another machine. But When I run the program I got the error message "can't locate Net /Telnet.pm". where can I get this module? Thanks, susi
9
3383
by: susinthaa | last post by:
Hi, How to copy a file from solaris to windows? Thanks, susi
5
7693
by: Sendil kumar | last post by:
Hi All, The FtpWebRequest.GetResponse( ) method is not giving "550 File not found exception " when I do a directory list operation on a invalid(not present) directory in HP Unix and Sun Solaris system, but the same is working fine in windows. For example, this is my uri to connect to the Sun Solaris server machine "ftp://ssriniva:ssriniva@apfsun/apfqa/users/ssriniva/apfhome/config" here the 'config' folder is not present in the...
6
5512
by: sherrygomindes | last post by:
Hi I have written a perl script using the Telnet module. I need to remotely login in from one windows XP machine to another XP machine. But i get errors which i can't figure out the reason. Please someone help me its very very urgent. here is my code: #!/usr/bin/perl -w
0
8994
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9250
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.