
Sound Control Alguem conhece esse sistema?
#3 Visitante_.EC_*
Posted 29 março 2008 - 06:03
Vc desenterrou um tópico super antigo para fazer um anúncio de venda de um software PIRATA! Serei obrigado a lhe dar o seu primeiro alerta.
#4
Posted 29 março 2008 - 06:09
Vale lembrar que você não deveria estar anunciando aqui, mesmo se fosse um software legal. De acordo com o item 4.1 das REGRAS do fórum, anuncios devem ser realizados apenas na sala Anúncios. Tenha mais cuidado da próxima vez "chefinhu".
#5
Posted 30 março 2008 - 11:28
#6 Visitante_.EC_*
Posted 30 março 2008 - 11:47
Tudo bem amigo, só que vc ressucitou um tópico de mais de 6 meses para fazer um anúncio, que é contra as novas regras do fórum.
#7
Posted 30 março 2008 - 12:22
Tudo bem amigo, só que vc ressucitou um tópico de mais de 6 meses para fazer um anúncio, que é contra as novas regras do fórum.
#9
Posted 30 março 2008 - 04:09
Sabe me dizer porque o SoundControl desliga todas as radios todo domingo as 04:03 da manhã? E se vc tenta mudar o horario do servidor ele desliga todas as radios assim que der 04:03 da manha de qualquer dia?
Abraços
Abraços
Ahh..e não é só 1 servidor que tenho o souncontrol, sao 2, e os 2 fazem a mesma coisa.
Tentei pular o Domingo e ir pra segunda modificando o horario do servidor, sem exito, ele desligou as radio na segunda as 04:03 AM.
=/
#10 Visitante_.EC_*
Posted 30 março 2008 - 04:44
Veja se tem algo relacionado a isso na crontab.
#11
Posted 30 março 2008 - 06:50
Veja se tem algo relacionado a isso na crontab.
Obrigado pela dica .E.C
Todos os meus dedicados tem isso no crontab:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Na realidade o que deve estar reiniciando é o apache ou httpd pq as radios apenas desligam, mas o ondemand continua ativo, se eu ligar as radios pelo painel o ondemand volta a tocar sozinho. Se a maquina reinicia-se tudo pararia inclusive o ondemand e eu teria que reiniciar mysql, httpd e ftp.
Cara, não aguento mais ter que acordar as 4:00 da matina todo domingo pra ligar todas as radios.
Pode me dar uma luz?
Se eu deletar esse run-parts no crontab? Será que vai dar pau em tudo?
Abraços
#12 Visitante_.EC_*
Posted 30 março 2008 - 09:42
Poste o conteúdo dos seguintes arquivos:
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
Poste o conteúdo desses arquivos da seguinte forma:
[b]NOME DO ARQUIVO[/ b]
[quote]CONTEÚDO DO ARQUIVO[/ quote]
#13
Posted 30 março 2008 - 11:24
Na verdade são 4 pastas: cron.hourly / cron.daily /cron.weekly / cron.monthly
- Pasta /etc/cron.hourly não tem nada dentro, nem listando com ls -a.
- Pasta /etc/cron.daily:
Tem os seguintes 9 arquivos:
00-logwatch / 0anacron / prelink / slocate.cron / yum.cron
00-makewhatis.cron / logrotate / rpm / tmpwatch
conteudo de cada um deles:
00-logwatch / (ESSE É ENORME!!!)
$ENV{'LANG'} = 'en_US'; # Hack to fix RH bug #81144
use strict;
##########################################################################
# $Id: logwatch.pl,v 1.113 2004/06/23 15:01:17 kirk Exp $
##########################################################################
# Most current version can always be found at:
# ftp://ftp.logwatch.org/pub/redhat/RPMS
########################################################
# This was written and is maintained by:
# Kirk Bauer <kirk@kaybee.org>
#
# Please send all comments, suggestions, bug reports,
# etc, to logwatch@logwatch.org.
#
########################################################
my $BaseDir = "/etc/log.d";
#my $BaseDir = "/home/kirk/cvs-work/logwatch";
my $ConfigDir = "$BaseDir/conf";
#Added to create switches for different os options -mgt
#For now working on Linux and SunOS
my $OSname = `uname -s`;
chomp $OSname;
my $Version = '5.2.2';
my $VDate = '06/23/04';
#############################################################################
use Getopt::Long;
my (%Config, @ServiceList, @LogFileList, %ServiceData, %LogFileData);
my (@AllShared, @AllLogFiles, @FileList);
# These need to not be global variables one day
my (@ReadConfigNames, @ReadConfigValues);
# Default config here...
$Config{'detail'} = 0;
$Config{'mailto'} = "root";
$Config{'save'} = "";
$Config{'print'} = 0;
$Config{'range'} = "yesterday";
$Config{'debug'} = 0;
$Config{'archives'} = 0;
$Config{'tmpdir'} = "/tmp";
$Config{'splithosts'} = 0;
$Config{'multiemail'} = 0;
# Logwatch now does some basic searching for logs
# So if the log file is not in the log path it will check /var/adm
# and then /var/log -mgt
$Config{'logdir'} = "/var/log";
chomp($Config{'hostname'} = `hostname`);
#############################################################################
sub Usage () {
# Show usage for this program
print "\nUsage: $0 [--detail <level>] [--logfile <name>]\n" .
" [--print] [--mailto <addr>] [--archives] [--range <range>] [--debug <level>]\n" .
" [--save <filename>] [--help] [--version] [--service <name>]\n" .
" [--splithosts] [--multiemail]\n\n";
print "--detail <level>: Report Detail Level - High, Med, Low or any #.\n";
print "--logfile <name>: *Name of a logfile definition to report on.\n";
print "--service <name>: *Name of a service definition to report on.\n";
print "--print: Display report to stdout.\n";
print "--mailto <addr>: Mail report to <addr>.\n";
print "--archives: Use archived log files too.\n";
print "--save <filename>: Save to <filename>.\n";
print "--range <range>: Date range: Yesterday, Today or All.\n";
print "--debug <level>: Debug Level - High, Med, Low or any #.\n";
print "--splithosts: Create a report for each host in syslog.\n";
print "--multiemail: Send each host report in a separate email. Ignored if \n";
print " not using --splithosts.\n";
print "--version: Displays current version.\n";
print "--help: This message.\n";
print "* = Switch can be specified multiple times...\n\n";
exit (99);
}
my %wordsToInts = (yes => 1, no => 0,
true => 1, false => 0,
on => 1, off => 0,
high => 10,
med => 5, medium => 5,
low => 0);
sub getInt {
my $word = shift;
my $tmpWord = lc $word;
$tmpWord =~ s/\W//g;
return $wordsToInts{$tmpWord} if (defined $wordsToInts{$tmpWord});
unless ($word =~ s/^"(.*)"$/$1/) {
return lc $word;
}
return $word;
}
sub CleanVars {
foreach (keys %Config) {
$Config{$_} = getInt($Config{$_});
}
}
sub PrintStdArray (@) {
my @ThisArray = @_;
my $i;
for ($i=0;$i<=$#ThisArray;$i++) {
print "[" . $i . "] = " . $ThisArray[$i] . "\n";
}
}
sub PrintConfig () {
# for debugging, print out config...
foreach (keys %Config) {
print $_ . ' -> ' . $Config{$_} . "\n";
}
print "Service List:\n";
PrintStdArray @ServiceList;
print "\n";
print "LogFile List:\n";
PrintStdArray @LogFileList;
print "\n\n";
}
# for debugging...
sub PrintServiceData () {
my ($ThisKey1,$ThisKey2,$i);
foreach $ThisKey1 (keys %ServiceData) {
print "\nService Name: " . $ThisKey1 . "\n";
foreach $ThisKey2 (keys %{$ServiceData{$ThisKey1}}) {
next unless ($ThisKey2 =~ /^\d+-/);
print " $ThisKey2 = $ServiceData{$ThisKey1}{$ThisKey2}\n";
}
for ($i=0;$i<=$#{$ServiceData{$ThisKey1}{'logfiles'}};$i++) {
print " Logfile = " . $ServiceData{$ThisKey1}{'logfiles'}[$i] . "\n";
}
}
}
# for debugging...
sub PrintLogFileData () {
my ($ThisKey1,$ThisKey2,$i);
foreach $ThisKey1 (keys %LogFileData) {
print "\nLogfile Name: " . $ThisKey1 . "\n";
foreach $ThisKey2 (keys %{$LogFileData{$ThisKey1}}) {
next unless ($ThisKey2 =~ /^\d+-/);
print " $ThisKey2 = $LogFileData{$ThisKey1}{$ThisKey2}\n";
}
for ($i=0;$i<=$#{$LogFileData{$ThisKey1}{'logfiles'}};$i++) {
print " Logfile = " . $LogFileData{$ThisKey1}{'logfiles'}[$i] . "\n";
}
for ($i=0;$i<=$#{$LogFileData{$ThisKey1}{'archives'}};$i++) {
print " Archive = " . $LogFileData{$ThisKey1}{'archives'}[$i] . "\n";
}
}
}
sub ReadConfigFile ($) {
my $FileName = $_[0];
@ReadConfigNames = ();
@ReadConfigValues = ();
if ($Config{'debug'} > 5) {
print "ReadConfigFile: Opening " . $FileName . "\n";
}
open (READCONFFILE, $FileName) or die "Cannot open file $FileName: $!\n";
while (my $line = <READCONFFILE>) {
if ($Config{'debug'} > 9) {
print "ReadConfigFile: Read Line: " . $line;
}
$line =~ s/#.*$//;
next if ($line =~ /^\s*$/);
my ($name, $value) = split /=/, $line, 2;
$name =~ s/^\s+//; $name =~ s/\s+$//;
if ($value) { $value =~ s/^\s+//; $value =~ s/\s+$//; }
else { $value = ''; }
push @ReadConfigNames, lc $name;
push @ReadConfigValues, getInt $value;
if ($Config{'debug'} > 7) {
print "ReadConfigFile: Name=" . $name . ", Value=" . $value . "\n";
}
}
close READCONFFILE;
}
#############################################################################
# Add / to BaseDir
unless ($BaseDir =~ m=/$=) {
$BaseDir = $BaseDir . "/";
}
# Load main config file...
if ($Config{'debug'} > 8) {
print "\nDefault Config:\n";
PrintConfig();
}
CleanVars();
my $OldMailTo = $Config{'mailto'};
my $OldPrint = $Config{'print'};
ReadConfigFile ($ConfigDir . "/logwatch.conf");
for (my $i = 0; $i <= $#ReadConfigNames; $i++) {
if ($ReadConfigNames[$i] eq "logfile") {
push @LogFileList, $ReadConfigValues[$i];
} elsif ($ReadConfigNames[$i] eq "service") {
push @ServiceList, $ReadConfigValues[$i];
} else {
$Config{$ReadConfigNames[$i]} = $ReadConfigValues[$i];
}
}
CleanVars();
if ($OldMailTo ne $Config{'mailto'}) {
$Config{'print'} = 0;
} elsif ($OldPrint ne $Config{'print'}) {
$Config{'mailto'} = "";
}
if ($Config{'debug'} > 8) {
print "\nConfig After Config File:\n";
PrintConfig();
}
# Options time...
my @TempLogFileList = ();
my @TempServiceList = ();
my $Help = 0;
my $ShowVersion = 0;
$OldMailTo = $Config{'mailto'};
$OldPrint = $Config{'print'};
GetOptions ( "d|detail=s" => \$Config{'detail'},
"l|logfile=s@" => \@TempLogFileList,
"logdir=s" => \$Config{'logdir'},
"s|service=s@" => \@TempServiceList,
"p|print" => \$Config{'print'},
"m|mailto=s" => \$Config{'mailto'},
"save=s" => \$Config{'save'},
"a|archives" => \$Config{'archives'},
"debug=s" => \$Config{'debug'},
"r|range=s" => \$Config{'range'},
"h|help" => \$Help,
"v|version" => \$ShowVersion,
"hostname=s" => \$Config{'hostname'},
"splithosts" => \$Config{'splithosts'},
"multiemail" => \$Config{'multiemail'},
) or Usage();
$Help and Usage();
if ($ShowVersion) {
print "Logwatch $Version (released $VDate)\n";
exit 0;
}
CleanVars();
if ($OldMailTo ne $Config{'mailto'}) {
$Config{'print'} = 0;
} elsif ($OldPrint ne $Config{'print'}) {
$Config{'mailto'} = "";
}
if ($Config{'debug'} > 8) {
print "\nCommand Line Parameters:\n Log File List:\n";
PrintStdArray @TempLogFileList;
print "\n Service List:\n";
PrintStdArray @TempServiceList;
print "\nConfig After Command Line Parsing:\n";
PrintConfig();
}
if ($#TempLogFileList > -1) {
@LogFileList = @TempLogFileList;
for (my $i = 0; $i <= $#LogFileList; $i++) {
$LogFileList[$i] = lc($LogFileList[$i]);
}
@ServiceList = ();
}
if ($#TempServiceList > -1) {
@ServiceList = @TempServiceList;
for (my $i = 0; $i <= $#ServiceList; $i++) {
$ServiceList[$i] = lc($ServiceList[$i]);
}
}
if ( ($#ServiceList == -1) and ($#LogFileList == -1) ) {
push @ServiceList, 'all';
}
if ($Config{'debug'} > 5) {
print "\nConfig After Everything:\n";
PrintConfig();
}
#############################################################################
# Find out what services are defined...
my (@TempAllServices, $ThisFile, $count);
opendir(SERVICESDIR, $ConfigDir . '/services') or
die $ConfigDir . "/services: $!";
my @services = grep !-d && /\.conf$/, readdir SERVICESDIR;
closedir SERVICESDIR;
foreach my $f (@services) {
my $ThisService = lc $f;
$ThisService =~ s/\.conf$//;
push @TempAllServices, $ThisService;
ReadConfigFile($ConfigDir . "/services/$f");
for (my $i = 0; $i <= $#ReadConfigNames; $i++) {
if ($ReadConfigNames[$i] eq 'logfile') {
push @{$ServiceData{$ThisService}{'logfiles'}}, $ReadConfigValues[$i];
} elsif ($ReadConfigNames[$i] =~ /^\*/) {
$count++;
$ServiceData{$ThisService}{+sprintf("%03d-%s", $count, $ReadConfigNames[$i])} = $ReadConfigValues[$i];
} else {
$ServiceData{$ThisService}{$ReadConfigNames[$i]} = $ReadConfigValues[$i];
}
}
}
my @AllServices = sort @TempAllServices;
# Find out what logfiles are defined...
opendir(LOGFILEDIR, $ConfigDir . "/logfiles") or die $ConfigDir . "/logfiles/, no such directory.\n";
while (defined($ThisFile = readdir(LOGFILEDIR))) {
unless (-d $ConfigDir . "/logfiles/" . $ThisFile) {
my $ThisLogFile = $ThisFile;
if ($ThisLogFile =~ s/\.conf$//i) {
push @AllLogFiles, $ThisLogFile;
ReadConfigFile($ConfigDir . "/logfiles/" . $ThisFile);
for (my $i = 0; $i <= $#ReadConfigNames; $i++) {
if ($ReadConfigNames[$i] eq "logfile") {
#Lets try and find the logs -mgt
if (-e "$Config{'logdir'}/$ReadConfigValues[$i]") {
push @{$LogFileData{$ThisLogFile}{'logfiles'}}, $ReadConfigValues[$i];
} elsif (-e "/var/adm/$ReadConfigValues[$i]") {
push @{$LogFileData{$ThisLogFile}{'logfiles'}}, "adm/$ReadConfigValues[$i]";
} elsif (-e "/var/log/$ReadConfigValues[$i]") {
push @{$LogFileData{$ThisLogFile}{'logfiles'}}, "log/$ReadConfigValues[$i]";
} else {
#Fallback to default even if it doesn't exist -mgt
push @{$LogFileData{$ThisLogFile}{'logfiles'}},
$ReadConfigValues[$i];
}
} elsif ($ReadConfigNames[$i] eq "archive") {
push @{$LogFileData{$ThisLogFile}{'archives'}}, $ReadConfigValues[$i];
} elsif ($ReadConfigNames[$i] =~ /^\*/) {
$count++;
$LogFileData{$ThisLogFile}{+sprintf("%03d-%s", $count, $ReadConfigNames[$i])} = $ReadConfigValues[$i];
} else {
$LogFileData{$ThisLogFile}{$ReadConfigNames[$i]} = $ReadConfigValues[$i];
}
}
}
}
}
closedir(LOGFILEDIR);
# Find out what shared functions are defined...
opendir(SHAREDDIR,$BaseDir . "scripts/shared") or die $BaseDir . "scripts/shared/, no such directory.\n";
while (defined($ThisFile = readdir(SHAREDDIR))) {
unless (-d $BaseDir . "scripts/shared/" . $ThisFile) {
push @AllShared, lc($ThisFile);
}
}
closedir(SHAREDDIR);
if ($Config{'debug'} > 5) {
print "\nAll Services:\n";
PrintStdArray @AllServices;
print "\nAll Log Files:\n";
PrintStdArray @AllLogFiles;
print "\nAll Shared:\n";
PrintStdArray @AllShared;
}
#############################################################################
# Time to expand @ServiceList, using @LogFileList if defined...
if ((scalar @ServiceList > 1) && (grep /^all$/i, @ServiceList)) {
# This means we are doing *all* services ... but excluding some
my %tmphash;
foreach my $item (@AllServices) {
$tmphash{lc $item} = "";
}
foreach my $service (@ServiceList) {
next if $service =~ /^all$/i;
if ($service =~ /^\-(.+)$/) {
my $offservice = $1;
if (! exists $tmphash{lc $offservice}) {
die "Nonexistent service to disable: $offservice\n";
}
delete $tmphash{lc $offservice};
} else {
die "Wrong configuration entry for \"Service\", if \"All\" selected, only \"-\" items are allowed\n";
}
}
@ServiceList = ();
foreach my $keys (keys %tmphash) {
push @ServiceList, $keys;
}
@LogFileList = ();
} elsif ( $ServiceList[0] and ($ServiceList[0] eq 'all') and ($#ServiceList == 0) ) {
# This means we are doing *all* services...
@ServiceList = @AllServices;
@LogFileList = ();
} else {
my $ThisOne;
while (defined($ThisOne = pop @LogFileList)) {
unless ($LogFileData{$ThisOne}) {
die "Logwatch is not configured to use logfile: $ThisOne\n";
}
foreach my $ThisService (keys %ServiceData) {
for (my $i = 0; $i <= $#{$ServiceData{$ThisService}{'logfiles'}}; $i++) {
if ( $ServiceData{$ThisService}{'logfiles'}[$i] eq $ThisOne ) {
push @ServiceList,$ThisService;
}
}
}
}
@TempServiceList = sort @ServiceList;
@ServiceList = ();
my $LastOne = "";
while (defined($ThisOne = pop @TempServiceList)) {
unless ( ($ThisOne eq $LastOne) or ($ThisOne eq 'all') or ($ThisOne =~ /^-/)) {
unless ($ServiceData{$ThisOne}) {
die "Logwatch does not know how to process service: $ThisOne\n";
}
push @ServiceList, $ThisOne;
}
$LastOne = $ThisOne;
}
}
# Now lets fill up @LogFileList again...
foreach my $ServiceName (@ServiceList) {
foreach my $LogName ( @{$ServiceData{$ServiceName}{'logfiles'} } ) {
unless ( grep m/$LogName/, @LogFileList ) {
push @LogFileList, $LogName;
}
}
}
if ($Config{'debug'} > 7) {
print "\n\nAll Service Data:\n";
PrintServiceData;
print "\nServices that will be processed:\n";
PrintStdArray @ServiceList;
print "\n\n";
print "\n\nAll LogFile Data:\n";
PrintLogFileData;
print "\nLogFiles that will be processed:\n";
PrintStdArray @LogFileList;
print "\n\n";
}
#############################################################################
my $TempDir;
my $UseMkTemp = $Config{'usemktemp'};
my $MkTemp = $Config{'mktemp'} || '';
if ($UseMkTemp and (-x $MkTemp)) {
$TempDir = `$MkTemp -d $Config{'tmpdir'}/logwatch.XXXXXXXX 2>/dev/null`;
chomp($TempDir);
unless (($? == 0) and $TempDir) {
die "Failed to create $Config{'tmpdir'}/logwatch.XXXXXXXX with mktemp!!\nDoes your mktemp support the -d option??\nIf not, modify logwatch.conf accordingly.\n";
}
if ($Config{'debug'}>7) {
print "\nMade Temp Dir: " . $TempDir . " with mktemp\n";
}
} else {
my $uid = $<;
my $gid = (split(' ', $( ))[0];
# Create the temporary directory...
$TempDir = $Config{'tmpdir'} . "/logwatch." . $$;
if ($Config{'debug'}>7) {
print "\nMaking Temp Dir: " . $TempDir . "\n";
}
`rm -rf $TempDir`;
mkdir ($TempDir,0700) or die "Failed to create TempDir: $TempDir (somebody may be attempting a root exploit!)\n";
`chown $uid $TempDir`;
`chgrp $gid $TempDir`;
`chmod 0700 $TempDir`;
unless (-d $TempDir and (not -l $TempDir)) {
die "$TempDir not a directory (somebody is attempting a root exploit!)\n";
}
unless ((stat($TempDir))[4] == $uid) {
die "$TempDir not owned by UID $uid (somebody is attempting a root exploit!)\n";
}
unless ((stat($TempDir))[5] == $gid) {
die "$TempDir not owned by GID $gid (somebody is attempting a root exploit!)\n";
}
unless ((stat($TempDir))[4] == $uid) {
die "$TempDir not owned by UID $uid (somebody is attempting a root exploit!)\n";
}
unless ((stat($TempDir))[5] == $gid) {
die "$TempDir not owned by GID $gid (somebody is attempting a root exploit!)\n";
}
unless (((stat($TempDir))[2] & 07777) == 0700) {
die "$TempDir permissions not 0700 (somebody is attempting a root exploit!)\n";
}
# Check to make sure nothing changed after we checked the ownership
unless (-d $TempDir and (not -l $TempDir)) {
die "$TempDir not a directory (somebody is attempting a root exploit!)\n";
}
`rm -rf $TempDir/*`;
unless (`ls $TempDir | wc -l` == 0) {
die "$TempDir not empty (somebody is attempting a root exploit!)\n";
}
}
unless ($TempDir =~ m=/$=) {
$TempDir .= "/";
}
#############################################################################
# Set up the environment...
$ENV{'LOGWATCH_DATE_RANGE'} = $Config{'range'};
$ENV{'LOGWATCH_DETAIL_LEVEL'} = $Config{'detail'};
$ENV{'LOGWATCH_DEBUG'} = $Config{'debug'};
$ENV{'LOGWATCH_TEMP_DIR'} = $TempDir;
if ($Config{'hostlimit'}) {
$ENV{'LOGWATCH_ONLY_HOSTNAME'} = $Config{'hostname'};
$ENV{'LOGWATCH_ONLY_HOSTNAME'} =~ s/\..*//;
}
if ($Config{'debug'}>4) {
foreach ('LOGWATCH_DATE_RANGE', 'LOGWATCH_DETAIL_LEVEL',
'LOGWATCH_TEMP_DIR', 'LOGWATCH_DEBUG', 'LOGWATCH_ONLY_HOSTNAME') {
if ($ENV{$_}) {
print "export $_='$ENV{$_}'\n";
}
}
}
my $LibDir = "$BaseDir/lib";
if ($ENV{PERL5LIB}) {
# User dirs should be able to override this setting
$ENV{PERL5LIB} = "$ENV{PERL5LIB}:$LibDir";
} else {
$ENV{PERL5LIB} = $LibDir;
}
#############################################################################
unless ($Config{'logdir'} =~ m=/$=) {
$Config{'logdir'} .= "/";
}
# Okay, now it is time to do pre-processing on all the logfiles...
my $LogFile;
foreach $LogFile (@LogFileList) {
next if ($LogFile eq 'none');
if (!defined($LogFileData{$LogFile}{'logfiles'})) {
print "*** Error: There is no logfile defined. Do you have a " . $ConfigDir . "conf/logfiles/" . $LogFile . ".conf file ?\n";
next;
}
@FileList = @{$LogFileData{$LogFile}{'logfiles'}};
if ($Config{'archives'} == 1) {
push @FileList, $TempDir . $LogFile . "-archive";
my $Archive;
foreach $Archive (@{$LogFileData{$LogFile}{'archives'}}) {
my $DestFile = $TempDir . $LogFile . "-archive";
unless ($Archive =~ m=^/=) {
$Archive = ($Config{'logdir'} . $Archive);
}
if ($Archive =~ m/gz$/) {
`/bin/zcat $Archive 2>/dev/null >> $DestFile`;
} else {
`/bin/cat $Archive 2>/dev/null >> $DestFile`;
}
}
}
my $FileText = "";
foreach $ThisFile (@FileList) {
if ($ThisFile =~ m=^/=) {
$FileText .= ($ThisFile . " ");
} else {
$FileText .= ( $Config{'logdir'} . $ThisFile . " ");
}
}
my $FilterText = " 2>/dev/null ";
foreach (sort keys %{$LogFileData{$LogFile}}) {
my $cmd = $_;
if ($cmd =~ s/^\d+-\*//) {
$FilterText .= ("| $BaseDir" . "scripts/shared/$cmd '$LogFileData{$LogFile}{$_}'" );
} elsif ($cmd =~ s/^\$//) {
$ENV{$cmd} = $LogFileData{$LogFile}{$_};
if ($Config{'debug'}>4) {
print "export $cmd='$LogFileData{$LogFile}{$_}'\n";
}
}
}
if (opendir (LOGDIR,$BaseDir . "scripts/logfiles/" . $LogFile)) {
foreach (sort readdir(LOGDIR)) {
unless ( -d $BaseDir . "scripts/logfiles/$LogFile/$_") {
$FilterText .= ("| $BaseDir" . "scripts/logfiles/$LogFile/$_");
}
}
closedir (LOGDIR);
}
if ($FileText) {
my $Command = $FileText . $FilterText . ">" . $TempDir . $LogFile;
if ($Config{'debug'}>4) {
print "\nPreprocessing LogFile: " . $LogFile . "\n" . $Command . "\n";
}
if ($LogFile !~ /^[-_\w\d]+$/) {
print STDERR "Unexpected filename: [[$LogFile]]. Not used\n"
} else {
`/bin/cat $Command`;
}
}
}
#populate the host lists if we're splitting hosts
my @hosts;
if ($Config{'splithosts'} eq 1) {
my $newlogfile;
my @logarray;
opendir (LOGDIR,$TempDir) || die "Cannot open dir";
@logarray = readdir(LOGDIR);
closedir (LOGDIR);
my $ecpcmd = ("| $BaseDir" . "scripts/shared/hostlist");
foreach $newlogfile (@logarray) {
my $eeefile = ("$TempDir" . "$newlogfile");
if ((!(-d $eeefile)) && (!($eeefile =~ m/-archive/))) {
`/bin/cat $eeefile $ecpcmd`;
}
}
#read in the final host list
open (HOSTFILE,"$TempDir/hostfile") || die $!;
@hosts = <HOSTFILE>;
close (HOSTFILE);
chomp @hosts;
@hosts = sort(@hosts);
}
#############################################################################
my $report_finish = "\n ###################### LogWatch End ######################### \n\n";
my $printing = '';
my $emailopen = '';
sub initprint {
return if $printing;
if ($Config{'print'} eq 1) {
*OUTFILE = *STDOUT;
} elsif ($Config{'save'} ne "") {
open(OUTFILE,">" . $Config{'save'}) or die "Can't open output file: $Config{'save'}\n";
} elsif ($OSname eq "SunOS") {
#Solaris mail doesn't know -s -mgt
if (($Config{'multiemail'} eq 1) || ($emailopen eq "")) {
open(OUTFILE,"|$Config{'mailer'} $Config{'mailto'}") or die "Can't execute /bin/mail\n";
print OUTFILE "From: LogWatcher\n";
print OUTFILE "To: $Config{'mailto'}\n";
print OUTFILE "Subject: LogWatch for $Config{'hostname'}\n\n";
if (($Config{'splithosts'} eq 1) && ($Config{'multiemail'} eq 0)) {
print OUTFILE "Reporting on hosts: @hosts\n";
}
$emailopen = 'y';
}
} else {
if (($Config{'multiemail'} eq 1) || ($emailopen eq "")) {
open(OUTFILE,"|$Config{'mailer'} -s \"LogWatch for $Config{'hostname'}\" " . $Config{'mailto'}) or die "Can't execute /bin/mail\n";
if (($Config{'splithosts'} eq 1) && ($Config{'multiemail'} eq 0)) {
print OUTFILE "Reporting on hosts: @hosts\n";
}
$emailopen = 'y';
}
}
$printing = 'y';
print OUTFILE "\n ################### LogWatch $Version ($VDate) #################### \n";
print OUTFILE " Processing Initiated: " . localtime(time) . "\n";
print OUTFILE " Date Range Processed: $Config{'range'}\n";
print OUTFILE " Detail Level of Output: $Config{'detail'}\n";
print OUTFILE " Logfiles for Host: $Config{'hostname'}\n";
print OUTFILE " ################################################################ \n";
}
sub parselogs {
my $Service;
foreach $Service (sort @ServiceList) {
$ENV{'PRINTING'} = $printing;
@FileList = @{$ServiceData{$Service}{'logfiles'}};
my $FileText = "";
foreach $ThisFile (@FileList) {
if (-s $TempDir . $ThisFile) {
$FileText .= ( $TempDir . $ThisFile . " ");
}
}
my $FilterText = " ";
foreach (sort keys %{$ServiceData{$Service}}) {
my $cmd = $_;
if ($cmd =~ s/^\d+-\*//) {
$FilterText .= ("$BaseDir" . "scripts/shared/$cmd '$ServiceData{$Service}{$_}' |" );
} elsif ($cmd =~ s/^\$//) {
$ENV{$cmd} = $ServiceData{$Service}{$_};
if ($Config{'debug'}>4) {
print "export $cmd='$ServiceData{$Service}{$_}'\n";
}
}
}
# ECP - insert the host stripping now
my $HostStrip = " ";
if ($Config{'splithosts'} eq 1) {
$HostStrip .= ("$BaseDir" . "scripts/shared/onlyhost");
}
if ( -f $BaseDir . "scripts/services/" . $Service ) {
$FilterText .= ("" . $BaseDir . "scripts/services/" . $Service );
}
else {
die "Can't open: " . $BaseDir . "scripts/services/" . $Service;
}
my $Command = '';
if ($FileList[0] eq 'none') {
$Command = " $FilterText 2>&1 ";
} elsif ($FileText) {
if ($HostStrip ne " ") {
$Command = " ( /bin/cat $FileText | $HostStrip | $FilterText) 2>&1 ";
} else {
$Command = " ( /bin/cat $FileText | $FilterText) 2>&1 ";
}
}
}
if ($Command) {
if ($Config{'debug'}>4) {
print "\nProcessing Service: " . $Service . "\n" . $Command . "\n";
}
open (TESTFILE,$Command . " |");
my $ThisLine;
my $has_output = 0;
while (defined ($ThisLine = <TESTFILE>)) {
next if ((not $printing) and $ThisLine =~ /^\s*$/);
initprint();
if (($has_output == 0) and ($ServiceData{$Service}{'title'})) {
print OUTFILE "\n --------------------- $ServiceData{$Service}{'title'} Begin ------------------------ \n\n";
$has_output = 1;
}
print OUTFILE $ThisLine;
}
close (TESTFILE);
if ($has_output and $ServiceData{$Service}{'title'}) {
print OUTFILE "\n ---------------------- $ServiceData{$Service}{'title'} End ------------------------- \n\n";
}
}
}
print OUTFILE $report_finish if ($printing);
if ($Config{'multiemail'} eq 1) {
close(OUTFILE) unless ($Config{'print'} eq 1);
}
}
if ($Config{'splithosts'} eq 1) {
my $Host;
foreach $Host (@hosts) {
$printing = '';
$ENV{'LOGWATCH_ONLY_HOSTNAME'} = $Host;
$ENV{'LOGWATCH_ONLY_HOSTNAME'} =~ s/\..*//;
$Config{'hostname'} = $Host;
parselogs();
} # ECP
} else {
parselogs();
}
close(OUTFILE) unless ($Config{'print'} eq 1);
#############################################################################
# Get rid of temp directory...
if ($Config{'debug'}<100) {
`rm -rf $TempDir`;
}
exit(0);
# vi: shiftwidth=3 tabstop=3 et
-----------------------------------------------------------------------------------------------------------
- AGORA O ARQUIVO / 00-makewhatis.cron
LOCKFILE=/var/lock/makewhatis.lock
# the lockfile is not meant to be perfect, it's just in case the
# two makewhatis cron scripts get run close to each other to keep
# them from stepping on each other's toes. The worst that will
# happen is that they will temporarily corrupt the database...
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
touch $LOCKFILE
makewhatis -u -w
exit 0
----------------------------------------------------------------------------------------------------------------------
-AGORA O ARQUIVO / 0anacron
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.
anacron -u cron.daily
----------------------------------------------------------------------------------------------------
-AGORA O / logrotate
/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
~
------------------------------------------------------------------------------------------------------
-AGORA O / prelink
. /etc/sysconfig/prelink
renice +19 -p $$ >/dev/null 2>&1
if [ "$PRELINKING" != yes ]; then
if [ -f /etc/prelink.cache ]; then
echo /usr/sbin/prelink -uav > /var/log/prelink.log
/usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1 \
|| echo Prelink failed with return value $? >> /var/log/prelink.log
rm -f /etc/prelink.cache
# Restart init if needed
[ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
fi
exit 0
fi
if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \
|| grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then
# If cache does not exist or is from older prelink versions or
# if we were asked to explicitely, force full prelinking
rm -f /etc/prelink.cache /var/lib/misc/prelink.force
PRELINK_OPTS="$PRELINK_OPTS -f"
date > /var/lib/misc/prelink.full
cp -a /var/lib/misc/prelink.{full,quick}
elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
-a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \
= /var/lib/misc/prelink.full ]; then
# If no more than PRELINK_NONRPM_CHECK_INTERVAL days elapsed from last prelink
# (be it full or quick) and no packages have been upgraded via rpm since then,
# don't do anything.
[ "`find /var/lib/misc/prelink.quick -mtime -${PRELINK_NONRPM_CHECK_INTERVAL:-7} 2>/dev/null`" \
-a -f /var/lib/rpm/Packages \
-a /var/lib/rpm/Packages -ot /var/lib/misc/prelink.quick ] && exit 0
date > /var/lib/misc/prelink.quick
# If prelink without -q has been run in the last
# PRELINK_FULL_TIME_INTERVAL days, just use quick mode
PRELINK_OPTS="$PRELINK_OPTS -q"
else
date > /var/lib/misc/prelink.full
cp -a /var/lib/misc/prelink.{full,quick}
fi
echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log
/usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1 \
|| echo Prelink failed with return value $? >> /var/log/prelink.log
# Restart init if needed
[ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
exit 0
-----------------------------------------------------------------------------------------------------------------------
- AGORA O / rpm
rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \
| sort > /var/log/rpmpkgs
~
--------------------------------------------------------------------------------------------------------------------------
-AGORA O / slocate.cron
. /etc/updatedb.conf
[ "$DAILY_UPDATE" != "yes" ] && exit 0
renice +19 -p $$ >/dev/null 2>&1
/usr/bin/updatedb
-------------------------------------------------------------------------------------------------------------------------
- AGORA O / tmpwatch
/usr/sbin/tmpwatch 720 /var/tmp
for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do
if [ -d "$d" ]; then
/usr/sbin/tmpwatch -f 720 $d
fi
done
~
------------------------------------------------------------------------------------------------------------------------
AGORA - / yum.cron
if [ -f /var/lock/subsys/yum ]; then
/usr/bin/yum -R 120 -e 0 -d 0 -y update yum
/usr/bin/yum -R 10 -e 0 -d 0 -y shell /etc/yum/yum-daily.yum
fi
-----------------------------------------------------------------------------------------------------------------
- FIM DA PASTA CRON.DAILY
------------------------------------------------
- AGORA A PASTA (cron.weekly)
TEM 3 ARQUIVOS: 00-makewhatis.cron / 0anacron / yum.cron
-ARQUIVO / 00-makewhatis.cron
LOCKFILE=/var/lock/makewhatis.lock
# the lockfile is not meant to be perfect, it's just in case the
# two makewhatis cron scripts get run close to each other to keep
# them from stepping on each other's toes. The worst that will
# happen is that they will temporarily corrupt the database...
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE; exit 255; }" EXIT
touch $LOCKFILE
makewhatis -w
exit 0
----------------------------------------------------------------------
-ARQUIVO / 0anacron
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.
anacron -u cron.weekly
--------------------------------------------------------------------
- ARQUIVO /yum.cron
if [ -f /var/lock/subsys/yum ]; then
/usr/bin/yum -e 0 -d 0 clean packages
fi
------------------------------------------------------------------
A ULTIMA PASTA / cron.monthly
CONTEM SOMENTE O ARQUIVO / 0anacron
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.
anacron -u cron.monthly
--------------------------------------------------------------------------------
BOM...É ISSO !!..QUE TRABALHEIRA !!.
Se descobrir alguma coisa me avisa por favor.
Grande abraço
This post has been edited by dudubroering: 31 março 2008 - 12:05
Razão por editar: Arquivos dentro de QUOTE
#14
Posted 31 março 2008 - 12:09
Eu é quem digo "QUE TRABALHEIRA"!
Tive que editar todo seu tópico para colocar os arquivos dentro de QUOTE, tenha mais atenção da próxima vez sam4, por favor.
O .EC chegou a avisar antes, como se tivesse previsto o trabalho do pobre moderador após o seu post.. =/
Abraços e boa sorte com a solução do seu problema.
#15
Posted 31 março 2008 - 01:11
Executando o comando top verifiquei o que está reiniciando na exata hora.
Exatamente o Httpd pelo root.
Onde está essa linha e porque está acontecendo isso eu não sei.
=/
#16 Visitante_.EC_*
Posted 31 março 2008 - 01:08
02 4 * * * root run-parts /etc/cron.daily
Ou seja, ele roda isso às 4h2m da madrugada, todos os dias.
#17
Posted 31 março 2008 - 01:10
Abraços
Ahh..e não é só 1 servidor que tenho o souncontrol, sao 2, e os 2 fazem a mesma coisa.
Tentei pular o Domingo e ir pra segunda modificando o horario do servidor, sem exito, ele desligou as radio na segunda as 04:03 AM.
=/
#18 Visitante_.EC_*
Posted 31 março 2008 - 05:45
Se é sempre em um determinado momento é dificil ser erros de instalação ou bloqueios de firewall, é algo na cron mesmo...
#19
Posted 01 abril 2008 - 06:27
O shoud control tem algum arquivo que deve ser colocado na cron?

Help










