10-12-2012
In general scripting pseudo-code, create a marker file with the last line # you examined in it immediately at the end of the scan. On the next pass, find files newer than the marker file and concatenate them to standard in, discarding the number of lines in the marker file. This way, the script only sees new lines from new files. If during the last scan there were logs log1 to log87 and log being written, and you saw 3214 lines of that file, later when you return there might be logs log1 to log99, but you want to start after line 3214 of log88 examining through log99 and then log.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello, I need a smart sed command that can take any of the following two as an input and give below mentioned output. As you can see, I am trying to convert some C code
INPUT:
struct abc_sample1 {
char myString;
UINT16 myValue1;
... (2 Replies)
Discussion started by: SiftinDotCom
2 Replies
2. UNIX for Advanced & Expert Users
Hi,
I have written a script that runs every five minutes in cron schedular. The Operating system is Fedora core 9. This script generates 2 log files, these log file size is increasing as some log data is being dumped into these 2 log files every five minutes. I need to logrotate these 2 files.... (1 Reply)
Discussion started by: renuka
1 Replies
3. Shell Programming and Scripting
I need this script to be able to check both IPs that are given to it and exit with an OK... if one of those expected IPs is returned.
The script is run like this:
/bin/dns_checker.pl -s 69.34.55.66 -q htt.jababa.com -e 69.44.56.33,45.47.43.55
Right now, the script is failing, but when I... (4 Replies)
Discussion started by: SkySmart
4 Replies
4. Shell Programming and Scripting
Hi,
I am new to perl scripting.
Can anybody help me in solving the below problem.
I have file, which is called map_file. According to map_file's last column data, i need a output file, which has repeats as like the map_file's last column name.
Thank you in advance
Vasanth (5 Replies)
Discussion started by: vasanth.vadalur
5 Replies
5. Shell Programming and Scripting
For the following command I need a perl script equivalent with a couple of more things -
cat /tmp/mail |grep Appname > /tmp/mail1;cat /tmp/mail >> /tmp/mail1; mail -s "mail subject here" allan@mail.com < /tmp/mail1; >/tmp/mail ; >/tmp/mail1
==================
cat /tmp/mail
***** Alert *****... (4 Replies)
Discussion started by: jacki
4 Replies
6. Shell Programming and Scripting
Hi,
I wanted to know can a custom script can be made available to run in
postroate
endscript
something like
postrotate
./scriptpath/sh-script.sh
endscript
Is this the correct syntax, or it will require any modification?
Thanks in Advance.
Neeryan (1 Reply)
Discussion started by: Neeryan
1 Replies
7. Shell Programming and Scripting
I have 3 variables
$file =abc_2011_11_01.txt (current day file)
$back = Yes
$forward = No
I need to search for 3 days back files / 3 days forward files if my current file is not present
logic is,
I need to download the current day file.
If it is missing, i need to look out for... (1 Reply)
Discussion started by: irudayaraj
1 Replies
8. Shell Programming and Scripting
i have the following script:
#!/usr/local/bin/perl
use STUN::Client;
use Data::Dumper;
use strict;
my $stun_client = STUN::Client->new;
$stun_client->stun_server('10.59.29.14');
my $r = $stun_client->get;
my $ip = $r->{ma_address};
print "IP: $ip\n\nResult (hash):... (5 Replies)
Discussion started by: SkySmart
5 Replies
9. Debian
Hi,
Yesterday I installed and configured logrotate on my Debian machine. I was expecting this to run at 06:25 in the morning and it actually did. All my old logs were compressed and zipped but the new logs were all with size equal to 0 bytes. Processes, while still running ok, they were not... (2 Replies)
Discussion started by: pmatsinopoulos
2 Replies
10. Shell Programming and Scripting
I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest.
I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies
LEARN ABOUT CENTOS
net::daemon::log
Net::Daemon::Log(3) User Contributed Perl Documentation Net::Daemon::Log(3)
NAME
Net::Daemon::Log - Utility functions for logging
SYNOPSIS
# Choose logging method: syslog or Win32::EventLog
$self->{'facility'} = 'mail'; # Default: Daemon
$self->{'logfile'} = undef; # Default
# Choose logging method: stderr
$self->{'logfile'} = 1;
# Choose logging method: IO handle
my $file = IO::File->new("my.log", "a");
$self->{'logfile'} = $file;
# Debugging messages (equivalent):
$self->Log('debug', "This is a debugging message");
$self->Debug("This is a debugging message");
# Error messages (equivalent):
$self->Log('err', "This is an error message");
$self->Error("This is an error message");
# Fatal error messages (implies 'die')
$self->Fatal("This is a fatal error message");
WARNING
THIS IS ALPHA SOFTWARE. It is *only* 'Alpha' because the interface (API) is not finalised. The Alpha status does not reflect code quality
or stability.
DESCRIPTION
Net::Daemon::Log is a utility class for portable logging messages. By default it uses syslog (Unix) or Win32::EventLog (Windows), but
logging messages can also be redirected to stderr or a log file.
Generic Logging
$self->Log($level, $msg, @args);
This is the generic interface. The logging level is in syslog style, thus one of the words 'debug', 'info', 'notice', 'err' or 'crit'.
You'll rarely need info and notice and I can hardly imagine a reason for crit (critical). In 95% of all cases debug and err will be
sufficient.
The logging string $msg is a format string similar to printf.
Utility methods
$self->Debug($msg, @args);
$self->Error($msg, @args);
$self->Fatal($msg, @args);
These are replacements for logging with levels debug and err. The difference between the latter two is that Fatal includes throwing a Perl
exception.
Chossing a logging target
By default logging will happen to syslog (Unix) or EventLog (Windows). However you may choose logging to stderr by setting
$self->{'logfile'} = 1;
This is required if neither of syslog and EventLog is available. An alternative option is setting
$self->{'logfile'} = $handle;
where $handle is any object supporting a print method, for example an IO::Handle object. Usually the logging target is choosen as soon as
you call $self->Log() the first time. However, you may force choosing the target by doing a
$self->OpenLog();
before calling Log the first time.
MULTITHREADING
The Multithreading capabitities of this class are depending heavily on the underlying classes Sys::Syslog, Win32::EventLog or IO::Handle.
If they are thread safe, you can well assume that this package is too. (The exception being that you should better call $self->OpenLog()
before threading.)
AUTHOR AND COPYRIGHT
Net::Daemon is Copyright (C) 1998, Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Phone: +49 7123 14887
Email: joe@ispsoft.de
All rights reserved.
You may distribute this package under the terms of either the GNU
General Public License or the Artistic License, as specified in the
Perl README file.
SEE ALSO
Net::Daemon(3), Sys::Syslog(3), Win32::EventLog(3), IO::Handle(3)
perl v5.16.3 2011-03-01 Net::Daemon::Log(3)