Need some guidance
Thanks in advance. Being a novice to Perl trying to write a perl script at my work in windows environment. I have couple of machines on Microsoft network load balancing (wlbs) And one url is being used to access those machines. Want to ping individual urls related to each machine on the cluster. And if a ping to a particular machine fails then want to initiate a command to that machine to shut down the network load balancer and send email/page to networkadmin so that users are not affected while accessing the url. I have planned to ping every 5 minutes. May be some of you already using a similar script. All help will be appreciated:) Thanks again Junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Timing the response
Hi, Due to a latency issue I want to time a particular intranet web page response It is a web page that looks for the dsl availability for an address being input When you hit submit it checks for the availability of dsl and output a response I want to time that response from the time the user hits submit and the output page is displayed with a result The idea I have is to submit a fixed address thru a perl script onto that page every five minutes or so The output of script should go into a log file with a time stamp as to how much time it took to get the result Is there any way to do this, or if someone already has something similar who can guide me please I will appreciate it Thanks junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl2exe
Hi, I have been using it for quite some time and never had a problem. I am using it on Win NT platform Let me know if you need further assistance A wild guess would be install perl again probably thanks junaid -Original Message- From: Scott Barnett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 13, 2002 9:57 AM To: [EMAIL PROTECTED] Subject: perl2exe Hi, I am try to create a .exe with perl2exe on a Win32 platform and keep getting the BSOD or freeze ups. I been to indigostar's site to try to dig up a troubleshooting page, but no luck. Has anyone else had problems with perl2exe. Thanks, Scott Barnett Home Care Medical - Technical Support Specialist 1-800-369-6939 1-262-786-9870 ext.214 E-Mail [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need help
Hi, Thanks in advance, if someone can help me out I am trying to read the last 10 lines of a log file. If the script finds a word ERROR it should email and log the event. If not then do nothing. Some how the other first part is working If it finds the word ERROR it does what needs to be done but when it do not find the word it doesn't do anything I am about to pull my hair. Can some one help me please thanks junaid open(INFILE, $File); $size = @lines = (INFILE); close (INFILE); $cnt = 0; $tail = 10; foreach (@lines) { if (($cnt ($size - $tail)) and (/\berror\b/i)) { print $_; $cnt++; print LOG xyz log has a problem\n; email (\nxyz log has a problem on $t\n); exit; } else { print I am doing great; print LOG xyz is working fine\n; print LOG No E-mail is being sent\n; close LOG; exit; } } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Perl2exe
I have been using this for a long time and it works fine with me Please visit the following location and download it http://www.indigostar.com/perl2exe.htm junaid -Original Message- From: Jackson, Harry [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 9:37 AM To: '[EMAIL PROTECTED]' Subject: RE: Perl2exe -Original Message- From: Shishir K. Singh [mailto:[EMAIL PROTECTED]] There's perl2app that comes bundled with the Perl Dev Kit on Active State. Unfortunately, the whole package comes with a price. Other than that, I am not sure if there are any other perl exe conversion pgm. I might have known it. I have managed to get it working but am not really that happy with it. Does anyone know what kind of work is involved in writing something like perl2exe. I imagine it is well beyond my abilities but it would be interesting to see how it is done. Harry. * COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates (COLT) and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need help
Hi, I need little help I wrote these lines which basically pings a server one time and if ping goes fine, nothing is done But if pings fails it sends email What I want is that it should ping three times in a row when the ping fails and then sends email It should not send email if it fails to ping once Thanks in advance junaid @result=system(tnsping smith); foreach $line (@result) { if ($line eq 0) { print LOG Pinging to smith went OK\n; print LOG No E-mail is being sent\n; } else { print LOG Unable to ping smith\n; email (\nUnable to Ping smith on $t\n); close LOG; exit; }; }; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pinging
I need some help I wrote a perl script which runs on win NT and pings the other server to ensure its availability in the network In case if ping fails it responds with email and page If I need to ping a specific port on that server, how I can accomplish that I can check that port thru a url in the intranet using the browser Is it possible to check for port availability by using url thru perl script if not thru command line Any help will be great Thanks in advance junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Execute .exe or .bat files from perl??
This might help you # looks for the existence of batch or exe files then logs it in a log file or if do not # find it exits and then thru system command execute it you can also alter it to get email or page if you want to do so use win32; if (-e $batch) {print LOG $batch exist; } else {print LOG $batch do not exist\n; close LOG; exit; system ($batch); junaid :) -Original Message- From: Rob [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 5:47 PM To: [EMAIL PROTECTED] Subject: Execute .exe or .bat files from perl?? Anyone know how to call a .exe or .bat file from a perl script? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pinging
hi, I am new to perl and looking to ping an oracle database located on an unix machine from win NT Has anyone have any idea how this can be accomplished thanks junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: text editors
Textpad is one good option It has bunch of nice things built into it http://www.wowwebdesigns.com/tools/id_20/ junaid -Original Message- From: ss004b3324 [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 2:17 AM To: Beginners Subject: RE: text editors Speaking of text editors, anyone know of a good one that has line #ing for W2K? Free, of course (I am a student). Syn - line numbering and lots more: http://web.utanet.at/ascherst/syn/index.html Shaun --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.332 / Virus Database: 186 - Release Date: 06/03/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Checking logs in NT
Hi,folks thanks in advance Can anyone help me out on two things I am using perl in win NT environment 1. How to go thru a log.txt file to check for an error string thru perl script 2. How to check and start NT services thru perl script Your help is highly appreciated thanks junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: system calls
I used the system command myself in Perl in NT environment and it work fine I called a batch file with it then the out put was later used in the script No problems Junaid -Original Message- From: Sidharth Malhotra [mailto:[EMAIL PROTECTED]] Sent: Friday, September 21, 2001 12:05 PM To: Jonathan Howe; [EMAIL PROTECTED] Subject: RE: system calls I did this in one of my programs and it seemed to work just fine: system($command ); Which, I believe, runs your command in the background and lets you return to your program. (Please correct me if I am wrong). This will only work on *nix systems. Sid. -Original Message- From: Jonathan Howe [mailto:[EMAIL PROTECTED]] Sent: Friday, September 21, 2001 11:26 AM To: [EMAIL PROTECTED] Subject: system calls Is it possible when making a call to the system, using the system command our back ticks to have a script exit/finish with out hanging around for a return from the process handed to the system. cheers all -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: formatting text
Hi, # Define your fields my($fld1, $fld2, $fld3, $fld4, $fld5, $fld6, $fld7, $fld8); # load fields in array which are separated by pipe delimit foreach $val1(@arr1) # referring to values in array {($fld1, $fld2, $fld3, $fld4, $fld5, $fld6, $fld7, $fld8) = split(/\|/,$val1); # Print the selected fields print $fld4, '$fld3'($fld2)\n; I hope I have answered your question Take care junaid -Original Message- From: Edward [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 11:34 AM To: [EMAIL PROTECTED] Subject: formatting text Hi , I'm trying to extract clients with Lost-Carrier as Terminate-Cause from a raw radius file. I'm interested in 2 fields. User-name and Terminate Cause. On running my script. I get a full list of all client User-names. and those with Termiante-Cause. Can some one assist me One cannot guess the real difficulties of a problem before having solved it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing Module
Hi, I am using win NT Trying to install Perl module Config::Inifiles I followed every instruction posted on cpan but unable to do it correctly since my script is erroring out can someone please help me with detailed instructions thanks junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Calling a batch file from Perl script
Hi, Thanks in advance I have a small problem I wrote a Perl script in windows NT environment which uses a text file, which is an output of a batch file how it is possible to run that batch file from my script and then pause for like five seconds and then run rest of the script so that the text file which ran thru batch file can be utilized in the Perl script help will be appreciated Thanx junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Formatting text
Title: RE: Formatting text Hi, Here is my script, I am comparing two txt files which are pipe delimited line by line if they match then their is no output but if they do not match then it gives an output about the difference My both files are loaded in the array and I am comparing line by line How can I compare a value in a certain field within an array line by line between two files so that I can have result I want instead of comparing whole line The txt files are attachedfor your visual ease they are not pipe delimited and the field names are displayed, In the script they will be pipe delimited without any field name or header If you can help me out thanks my($snapshot, $baseline);# Defining txt files # First file$snapshot = "./302-snap.txt"; # List of Svcs currently running loc at c:\perl # Second file$baseline = "./302-base.txt"; # List of All Svcs which should be running my(@arr1, @arr2, @result); # Defining arraysmy($fld1, $fld2, $fld3, $fld4); # Defining variables for fieldsmy($match, $cnt, $val1, $val2, $finalresult); # Defining scalar variables$match = "N"; #Open snapshot file and insert every line into @arr1open(SNAPSHOT, $snapshot) or die "Unable to open $snapshot."; # Open the txt file and place it in filehandle $cnt = 0;while ( SNAPSHOT ) # Looping thru the filehandle snapshot{$arr1[$cnt] = $_;$cnt = $cnt + 1; } close (SNAPSHOT); # close the filehandle snapshot #Open baseline file and insert every line into @arr2open(BASELINE, $baseline) or die "Unable to open $baseline."; # Open the txt file and place it in filehandle $cnt = 0;while ( BASELINE ) # Looping thru the filehandle baseline{$arr2[$cnt] = $_;$cnt = $cnt + 1; } close (BASELINE); # close filehandle baseline # Outer loop is for baseline file# Inner loop is for snapshot file# Taking one element from @arr2 (baseline) and comparing it with all the elements in @arr1(snapshot) and # If their is no match then insert that name into @result. $cnt = 0;foreach $val2 (@arr2) # referring to baseline{foreach $val1 (@arr1) # referring to snapshot{if ($val1 eq $val2) {$match = "Y";}}if ($match eq "N") {$result[$cnt] = $val2;$cnt = $cnt + 1;} $match = "N";} $finalresult = 0; # initializing to zeroforeach $val1 (@result){$finalresult = $finalresult + 1;} if ($finalresult 0 ) {print "\nList of SICK Siebel-Components \n\n"; # If some svc is not functioningforeach $val1 (@result){($fld1,$fld2,$fld3,$fld4) = split(/\|/,"$val1");# separating req fields for outputprint "Svc-Component $fld4, of Siebel-Svc '$fld3'($fld2)\n";}}else{print "\nAll Siebel-Components are Functioning Fine\n"; # When all svcs are running fine} SBLSRVR_NAME SVC_NAME FULL_NAME SVC_COMP SVC_STATE SVC_STARTUP_STATE START_TIME END_TIME MAX_TASKS DFLT_SERVERS NUM_SCHED_TASKS NUM_RUN_TASKS SVC_STATUS SV MAX_MTS_PROCS ACTIVE_MTS_PROCS TOTAL_MTS_PROCS - --- --- - --- --- - --- - -- -- - --- S2_NXLKPRDSMECacheMgr Analysis Cache Manager SMECacheMgr Enabled Running08/24/2001 11:00:49 20 0 1 S2_NXLKPRDSMEProxyMgr Analysis Proxy Manager SMEProxyMgr Enabled Running08/24/2001 11:00:49 20 0 1 S2_NXLKPRDSMEQueryMgr Analysis Query Manager SMEQueryMgr Enabled Running08/24/2001 11:00:49 20 0 1 S2_NXLKPRDAsgnSrvr Assignment Manager AsgnSrvr Running Running08/24/2001 11:00:49 2 1 1 1 1 1 S2_NXLKPRDAsgnBatch Batch Assignment AsgnBatchEnabled Running08/24/2001 11:00:49 20 0 1 S2_NXLKPRDCTIRoute CTI Inbound Call RouterCTIRoute Enabled Running08/24/2001 11:00:49 20 0 1 S2_NXLKPRDDqmgr Data Quality Manager DqmgrEnabled
RE: Formatting text
Sorry I forgot about the platform It is on Windows NT platform thanks -Original Message- From: Gibbs Tanton - tgibbs [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 28, 2001 9:34 AM To: 'Najamuddin, Junaid '; '[EMAIL PROTECTED] ' Subject: RE: Formatting text If you are on a unix system...you can just say diff file1 file2. On Windows there is probably something comparable. -Original Message- From: Najamuddin, Junaid To: [EMAIL PROTECTED] Sent: 8/28/2001 9:18 AM Subject: Formatting text Hi, Here is my script, I am comparing two txt files which are pipe delimited line by line if they match then their is no output but if they do not match then it gives an output about the difference My both files are loaded in the array and I am comparing line by line How can I compare a value in a certain field within an array line by line between two files so that I can have result I want instead of comparing whole line The txt files are attached for your visual ease they are not pipe delimited and the field names are displayed, In the script they will be pipe delimited without any field name or header If you can help me out thanks my($snapshot, $baseline); # Defining txt files # First file $snapshot = ./302-snap.txt; # List of Svcs currently running loc at c:\perl # Second file $baseline = ./302-base.txt; # List of All Svcs which should be running my(@arr1, @arr2, @result); # Defining arrays my($fld1, $fld2, $fld3, $fld4); # Defining variables for fields my($match, $cnt, $val1, $val2, $finalresult); # Defining scalar variables $match = N; #Open snapshot file and insert every line into @arr1 open(SNAPSHOT, $snapshot) or die Unable to open $snapshot.; # Open the txt file and place it in filehandle $cnt = 0; while ( SNAPSHOT ) # Looping thru the filehandle snapshot { $arr1[$cnt] = $_; $cnt = $cnt + 1; } close (SNAPSHOT); # close the filehandle snapshot #Open baseline file and insert every line into @arr2 open(BASELINE, $baseline) or die Unable to open $baseline.; # Open the txt file and place it in filehandle $cnt = 0; while ( BASELINE ) # Looping thru the filehandle baseline { $arr2[$cnt] = $_; $cnt = $cnt + 1; } close (BASELINE); # close filehandle baseline # Outer loop is for baseline file # Inner loop is for snapshot file # Taking one element from @arr2 (baseline) and comparing it with all the elements in @arr1(snapshot) and # If their is no match then insert that name into @result. $cnt = 0; foreach $val2 (@arr2) # referring to baseline { foreach $val1 (@arr1) # referring to snapshot { if ($val1 eq $val2) { $match = Y; } } if ($match eq N) { $result[$cnt] = $val2; $cnt = $cnt + 1; } $match = N; } $finalresult = 0; # initializing to zero foreach $val1 (@result) { $finalresult = $finalresult + 1; } if ($finalresult 0 ) { print \nList of SICK Siebel-Components \n\n; # If some svc is not functioning foreach $val1 (@result) { ($fld1,$fld2,$fld3,$fld4) = split(/\|/,$val1);# separating req fields for output print Svc-Component $fld4, of Siebel-Svc '$fld3'($fld2)\n; } } else { print \nAll Siebel-Components are Functioning Fine\n; # When all svcs are running fine } 302-base.txt 302-snap.txt ATT3705189.txt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Formatting text
Thanks in advance How can we read a log text file which has columns and rows. The file has ten columns defined by a header/field name What i want is to out put into another text file but only the desired columns not all of them Some lines/records have duplicates so after this I want to sort them so that a record/line only apprears once can someone help me please. Oh, I am in NT environment Thanks again -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Formatting text
Title: RE: Formatting text Thanks Attached is a text file which needs formatting It has records withfields defined, but has some records repeated I want to format this file and out put to another one with fields of my choice and only one instance of each record Thanks -Original Message-From: Wagner-David [mailto:[EMAIL PROTECTED]]Sent: Friday, August 24, 2001 11:42 AMTo: 'Najamuddin, Junaid'Subject: RE: Formatting text I am unsure what you are really after. If you provided some input, code snippet, etc so the list can see. Along with how do you determine which columns are to be bypassed, then you might get a response. At this point, it is very vague for most to do something with. Wags ;) -Original Message- From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 09:06 To: '[EMAIL PROTECTED]' Subject: Formatting text Thanks in advance How can we read a log text file which has columns and rows. The file has ten columns defined by a header/field name What i want is to out put into another text file but only the desired columns not all of them Some lines/records have duplicates so after this I want to sort them so that a record/line only apprears once can someone help me please. Oh, I am in NT environment Thanks again -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] SBLSRVR_NAME SVC_NAME COMP_NAME SVC_COMP TASK_NUM TASK_PID SVC_MODE TASK_STATE START_TIME END_TIME TASK_STATUS - - - -- --- --- -- S2_NXLKPRDServerMgr ServerMgr ServerMgr 47148 881 Session NotRunning 08/23/2001 11:14:25 Processing List Tasks command S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47147 Session Completed 08/23/2001 11:14:09 08/23/2001 11:14:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47146 Session Completed 08/23/2001 11:13:09 08/23/2001 11:13:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47145 Session Completed 08/23/2001 11:12:09 08/23/2001 11:12:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47144 Session Completed 08/23/2001 11:11:09 08/23/2001 11:11:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47143 Session Completed 08/23/2001 11:10:09 08/23/2001 11:10:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47142 Session Completed 08/23/2001 11:09:08 08/23/2001 11:09:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47141 Session Completed 08/23/2001 11:08:08 08/23/2001 11:08:08 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47140 Session Completed 08/23/2001 11:07:08 08/23/2001 11:07:08 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDServerMgr ServerMgr ServerMgr 47139 753 Session Running 08/23/2001 11:06:27 Waiting for command S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47138 Session Completed 08/23/2001 11:06:08 08/23/2001 11:06:08 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47137 Session Completed 08/23/2001 11:05:08 08/23/2001 11:05:08 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47136 Session Completed 08/23/2001 11:04:08 08/23/2001 11:04:08 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47135 Session Completed 08/23/2001 11:03:08 08/23/2001 11:03:08
Comparison
Hi, If some one can help me out please I am brand new to Perl I wrote a prog which is working fine except for few glitches It should read two text files compare the snap.txt with base.txt and spit out the name of task which is not running in last hour or so The snap log file has list of tasks which are either completed, running or exited with error The snap log file carries log for more then a day or so What I am interested in is about the tasks not running or rendering error in last hour or so My prog list it but since there is a repetition of the same tasks over a period of time so it is not giving the right output I want to get the very latest instance of the task when it is erroring out The Base.txt contains the tasks which I am interested in to check which are like about 10 or so The log files are tab delimited Enclosed is the script along with the two text files Another option is to only read one file and look for specific tasks which are not running and the names of the tasks can be incorporated in the script. In the snap.txt file field 8 gives the task state If someone can help me out with the code in detail I appreciate it. Thanks snap.txt base.txt # Monitoring script use Win32; my($snapshot, $baseline); # Defining txt files # First file $snapshot = ./snap.txt; # List of Svcs currently running, file in c:\perl # Second file $baseline = ./base.txt; # List of All Svcs which should be running my(@arr1, @arr2, @result); # Defining arrays my($fld1, $fld2, $fld3, $fld4, $fld5, $fld6, $fld7, $fld8); # Defining variables for fields my($match, $cnt, $val1, $val2, $finalresult); # Defining scalar variables $match = N; #Open snapshot file and insert every line into @arr1 open(SNAPSHOT, $snapshot) or die Unable to open $snapshot.; # Open the txt file and place it in filehandle $cnt = 0; while ( SNAPSHOT ) # Looping thru the filehandle snapshot { $arr1[$cnt] = $_; $cnt = $cnt + 1; } close (SNAPSHOT); # close the filehandle snapshot #Open baseline file and insert every line into @arr2 open(BASELINE, $baseline) or die Unable to open $baseline.; # Open the txt file and place it in filehandle $cnt = 0; while ( BASELINE ) # Looping thru the filehandle baseline { $arr2[$cnt] = $_; $cnt = $cnt + 1; } close (BASELINE); # close filehandle baseline # Outer loop is for baseline file # Inner loop is for snapshot file # Taking one element from @arr2 (baseline) and comparing it with all the elements in @arr1(snapshot) and # If their is no match then insert that name into @result. $cnt = 0; foreach $val2 (@arr2) # referring to baseline { foreach $val1 (@arr1) # referring to snapshot { if ($val1 eq $val2) { $match = Y; } } if ($match eq N) { $result[$cnt] = $val2; $cnt = $cnt + 1; } $match = N; } $finalresult = 0; # initializing to zero foreach $val1 (@result) { $finalresult = $finalresult + 1; } if ($finalresult 0 ) { print \nList of SICK Siebel-Tasks \n\n; # If some svc is not functioning foreach $val1 (@result) { ($fld1,$fld2,$fld3,$fld4,$fld5,$fld6,$fld7,$fld8) = split(/\|/,$val1);# separating req fields for output print Siebel-Task $fld4; related to Siebel-Component $fld3 \n; } } else { print \nCheers! All Siebel-Tasks are Doing Well!\n; # When all svcs are running fine } SBLSRVR_NAME SVC_NAME COMP_NAME SVC_COMP TASK_NUM TASK_PID SVC_MODE TASK_STATE START_TIME END_TIME TASK_STATUS - - - -- --- --- -- S2_NXLKPRDServerMgr ServerMgr ServerMgr 47148 881 Session NotRunning 08/23/2001 11:14:25 Processing List Tasks command S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47147 Session Completed 08/23/2001 11:14:09 08/23/2001 11:14:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47146 Session Completed 08/23/2001 11:13:09 08/23/2001 11:13:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 47145 Session Completed 08/23/2001 11:12:09 08/23/2001 11:12:09 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRD
Sort by time the logs for last one hour
hi, I am new to Perl I wrote a script which basically pipe delimit the txt file What I want to do is to sort the records along with delimit by time I need the out put to show logs for the last one hour Can some one help me on this the text file has a column showing start time which shows both date and time when the task started Here is the code # picks up the file out.txt from c drive and after pipe delimit # put the output in outfinal.txt my $filename = c:\\out.txt; my $outfile = c:\\outfinal.txt; open (FILE,$filename) || die Cant open $filename - $!\n; open (OUTFILE,$outfile) || die Cant open $outfile - $!\n; @lines = FILE; close FILE; foreach $lines (@lines) { $lines =~ s/[ ,:]\s+/|/g; # delimit pipe print OUTFILE ($lines\n); }; close OUTFILE; out.txt Siebel Enterprise Applications Siebel Server Manager, Version 5.6.0.15 [6136] ENU Copyright (c) Siebel Systems, Inc. 1995-1998. This software is the property of Siebel Systems, Inc., 1855 South Grant Street, San Mateo, CA 94402-2667. User warrants that any use of this software is governed by the terms and conditions of the Siebel Systems Software License and Services Agreement which has been executed and with which the user agrees to comply. UNAUTHORIZED POSSESSION, DISCLOSURE OR USE OF THIS SOFTWARE OR THE INFORMATION CONTAINED HEREIN IS PROHIBITED BY FEDERAL AND STATE LAW. If you have received this software in error, please notify us by telephone immediately at (650) 295-5000. Type help for list of commands, help topic for detailed help srvrmgr:s2_nxlkprd list tasks for server s2_nxlkprd SBLSRVR_NAME SVC_NAME COMP_NAME SVC_COMP TASK_NUM TASK_PID SVC_MODE TASK_STATE START_TIME END_TIME TASK_STATUS - - - -- --- --- - S2_NXLKPRDServerMgr ServerMgr ServerMgr 37274 841 Session Running 08/14/2001 11:18:25 Processing List Tasks command S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37273 Session Completed 08/14/2001 11:18:12 08/14/2001 11:18:12 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDServerMgr ServerMgr ServerMgr 37272 Session Completed 08/14/2001 11:17:43 08/14/2001 11:17:44 Cleaning up S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37271 Session Completed 08/14/2001 11:17:12 08/14/2001 11:17:12 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37270 Session Completed 08/14/2001 11:16:11 08/14/2001 11:16:12 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37269 Session Completed 08/14/2001 11:15:15 08/14/2001 11:18:05 COMPLETED : Node HALPERT wrote 307 Kbytes, read 50 Kbytes, sent 1058 msgs, rcvd 1058 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37268 Session Completed 08/14/2001 11:15:11 08/14/2001 11:15:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37267 Session Completed 08/14/2001 11:14:11 08/14/2001 11:14:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37266 Session Completed 08/14/2001 11:13:11 08/14/2001 11:13:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37265 Session Completed 08/14/2001 11:12:11 08/14/2001 11:12:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDServerMgr ServerMgr ServerMgr 37264 810 Session Running 08/14/2001 11:11:34 Waiting for command S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37263 Session Completed 08/14/2001 11:11:11 08/14/2001 11:11:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs S2_NXLKPRDSynchMgr SynchMgr SynchMgr 37262 Session Completed 08/14/2001 11:10:11 08/14/2001 11:10:11 COMPLETED : Wrote 0 Kbytes, read 0 Kbytes, sent 0 msgs, rcvd 0 msgs
date and time
Hi, I am new with Perl if someone can help me out I wrote a script which reads two files and compares them and then prints out what is missing but since the txt files are kind of log files they have time and date column in it what i want is to out put only 2 hours old log after comparing how can i do that thanks junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Converting into exe
Hi, Can anyone tell me the procedure in detail please how to convert a Perl script into an executable Thanks Junaid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Incorporating script
Hi, Jerry Thanks for quick response I am quite new to perl If you can guide me and let me know how it can be done and what will be the syntax It will be a great help Thanks -Original Message- From: Jerry Preston [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 12:55 PM To: Najamuddin, Junaid Cc: [EMAIL PROTECTED] Subject: Re: Incorporating script Junaid, It looks to me that need to setup your bat and program to run as cron jobs. This way you can control the time and date you want them to run. Regards, Jerry Najamuddin, Junaid wrote: Hi, If someone can help me out please I wrote a perl script which opens two text files and then compares them and spit out the difference. It is an error checking program which runs on NT Platform. The first file has all the required processes listed and the second file lists current running processes. The second file is being generated at time intervals thru running a bat file manually. When you run that batch file it generates the second text file which has the current processes running. I want to ask you how I can incorporate that batch file in my script so that it can run on specified time intervals. After running the bat file the resultant text file is going to be my second file in the script. I want my script to kick off automatically at predefined time intervals, run bat file and then use the text file generated by bat file as the second file in the script. Can someone help me on this please Thanks Junaid Here is the script use Win32; my($snapshot, $baseline); # Defining txt files # First file $snapshot = ./secondfile.txt; # List of Svcs currently running, should be generated by the bat file # Second file $baseline = ./firstfile.txt; # List of All Svcs which should be running my(@arr1, @arr2, @result); # Defining arrays my($fld1, $fld2, $fld3, $fld4); # Defining variables for fields my($match, $cnt, $val1, $val2, $finalresult); # Defining scalar variables $match = N; #Open snapshot file and insert every line into @arr1 open(SNAPSHOT, $snapshot) or die Unable to open $snapshot.; # Open the txt file and place it in filehandle $cnt = 0; while ( SNAPSHOT ) # Looping thru the filehandle snapshot { $arr1[$cnt] = $_; $cnt = $cnt + 1; } close (SNAPSHOT); # close the filehandle snapshot #Open baseline file and insert every line into @arr2 open(BASELINE, $baseline) or die Unable to open $baseline.; # Open the txt file and place it in filehandle $cnt = 0; while ( BASELINE ) # Looping thru the filehandle baseline { $arr2[$cnt] = $_; $cnt = $cnt + 1; } close (BASELINE); # close filehandle baseline # Outer loop is for baseline file # Inner loop is for snapshot file # Taking one element from @arr2 (baseline) and comparing it with all the elements in @arr1(snapshot) and # If their is no match then insert that name into finalresult. $cnt = 0; foreach $val2 (@arr2) # referring to baseline { foreach $val1 (@arr1) # referring to snapshot { if ($val1 eq $val2) { $match = Y; } } if ($match eq N) { $result[$cnt] = $val2; $cnt = $cnt + 1; } $match = N; } $finalresult = 0; # initializing to zero foreach $val1 (@result) { $finalresult = $finalresult + 1; } if ($finalresult 0 ) { print \nList of process not running \n\n; # If some svc is not functioning foreach $val1 (@result) { ($fld1,$fld2,$fld3,$fld4) = split(/\|/,$val1);# separating req fields for output } } else { print \nAll process are running \n; # When all svcs are running fine } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Comparing two text files and outputting difference
Is someone out there to help me please Thanx -Original Message- From: Najamuddin, Junaid Sent: Wednesday, July 25, 2001 5:59 PM To: '[EMAIL PROTECTED]' Subject: Comparing two text files and outputting difference Hi, I am brand new on Perl Learning slowly though I will appreciate someone's help on this I wrote a small script with someone's help The script opens up two text files and goes thru it line by line They both are in same format. firstfile has all the entries the secondfile has some lines or entries missing. The script compares firstfile with secondfile and then spits out the whole line which is missing in the secondfile Instead of spiting the whole line I want the script to tell me the name of one specific string from the line, not the whole line I tried but was unable to do it correctly. Later I changed the firstfile entirely so that it has only one column of the names I am looking for in the secondfile but it did not work since it spitted all the names from the firstfile. I am attaching both firstfile and second file What I need is instead of comparing with firstfile I want it to compare it to thirdfile which only has names in one column In short I want the script to compare thirdfile (this has all entries in one column) with secondfile and spits me what it did not find in secondfile. If someone can help me please File: firstfile.txtFile: secondfile.txtFile: Thirdfile.txt Thanks Junaid use Win32; use Net::SMTP; my($input1, $input2); # Defining txt files # First file $input1 = ./secondfile.txt; # List of Svcs currently running #second file $input2 = ./firstfile.txt; # List of All Svcs which should be running my(@arr1, @arr2, @result); # Defining arrays my($match, $cnt, $currentval1, $currentval2, $resultarraysize); # Defining scalar variables $match = N; #Open first file and insert every line into @arr1 open(INPUT, $input1) or die Unable to open $input1.; # Open the txt file and place it filehandle $cnt = 0; while ( INPUT ) # Looping thru the file { $arr1[$cnt] = $_; $cnt = $cnt + 1; } close (INPUT); #Open second file and insert every line into @arr2 open(INPUT, $input2) or die Unable to open $input2.;# Open the txt file and place it filehandle $cnt = 0; while ( INPUT ) # Looping thru the file { $arr2[$cnt] = $_; $cnt = $cnt + 1; } close (INPUT); # Outer loop is for second file (firstfile) # Inner loop is for first file (secondfile) # Taking one element from @arr2 and comparing it with all the elements in @arr1 and # If their is no match then insert it into final result array. $cnt = 0; foreach $currentval2 (@arr2) { foreach $currentval1 (@arr1) { if ($currentval1 eq $currentval2) { $match = Y; } } if ($match eq N) { $result[$cnt] = $currentval2; $cnt = $cnt + 1; } $match = N; } $resultarraysize = 0; foreach $currentval1 (@result) { $resultarraysize = $resultarraysize + 1; } if ($resultarraysize 0 ) { print \nFollowing services are not Functioning\n\n; # If some svc is not functioning foreach $currentval1 (@result) { print $currentval1; } } else { print \nAll Services are Functioning Fine\n; # When all svcs are running fine when there is no difference between # both files } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]