Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Help e-mailing last 50 lines of log file

by Jenda (Abbot)
on Jul 18, 2002 at 17:17 UTC ( [id://182917]=note: print w/replies, xml ) Need Help??


in reply to Re: Help e-mailing last 50 lines of log file
in thread Help e-mailing last 50 lines of log file

Ha, ha, ha ... you are soooo funny.

But the AnonymousMonk seems to be a little confused as well. The lengthy code does a lot of things, but there's no tailing and mailing. What is the real question? How to get the results of tail.exe? Or how to include them in the email? Or what? And why did you include the service related code?

I think you want something like this:

$loglines = `tail -50 $logfile`; $message = <<"*END*"; This email was generated after an error was detected, the NetRestartService.pl script was executed. Log file: $loglines *END* $msg = MIME::Lite->new( From =>'NetRestartService', To =>'Test@test.com', Cc =>'Test2@test2.com', Subject =>'Perl Script to restart remote NT Service - NetRestartServ +ice.pl', Data => message , ); $msg->send;

  Jenda

Replies are listed 'Best First'.
Re: Re: Re: Help e-mailing last 50 lines of log file
by clarke (Initiate) on Jul 18, 2002 at 19:12 UTC
    Hi Jenda,

    Sorry for the confusion with the code above...I didn't put everything on the forum correctly. It was missing lots of code. I'm faily new at PERL and I'm learning as I go, putting bits and pieces of code together that I've obtained on the internet.

    I don't know how to put everything together. This is the first code section I want to use....The code will use "TAIL.exe" placed in the WINNT\SYSTEM32 directory. How do I get the the "TAILED" result from the "LOG1.LOG" and create a new log with that informaton. Once this is done, I need to send an email with the newly created log file. Once the email is sent the weblogic service needs to be restarted. (I want to run the scipt remotely).

    - Can I specify remote machines to run this script, for example "\\Server1\Logs\testlog.log" and remote service to restart "weblogic".

    *** THANKS AGAIN JENDA FOR YOUR WISDOM! ******
    PLEASE HELP ME PUT THIS TOGETHER.....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://182917]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-03-28 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found