hallo,
habe im forum diverse lösungen für das logrotate-apache-problem gefunden, aber irgendwie gibt es keine methode die 100% funkt. :(
nun, habe ich beschlossen nach den logrotate einen script zu starten, das den apache "richtig" reloaded.
_________________________
#!/usr/bin/perl
print "Cleanup apache...";
system("/etc/init.d/apache stop");
sleep 2;
system("killall -9 apache");
sleep 1;
$tmp = `/usr/bin/ipcs -s | grep www-data`;
@tmp= split(/n/,$tmp);
foreach $tmp (@tmp)
{
$tmp =~ s/[ ]{1,}/ /g;
$pid = (split(/ /,$tmp))[1];
system("/usr/bin/ipcrm sem $pid");
}
system("/etc/init.d/apache start");
_________________________
einziges problem bei diesen script: falls kein apache-prozess gefunden wird, bricht das script ab (logischerweise).
gibt es eine möglichkeit das zu umgehen? also, das er nicht abbricht oder ggf den apache einfach startet.
danke und gruss
toppas
logrotate und apache mal wieder
Re: logrotate und apache mal wieder
if ... else ... endif
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: logrotate und apache mal wieder
danke :(
ok, kann mir vielleicht jemand zeigen, wie ich in diesen script eine if...else... schleife einbauen kann? danke
ok, kann mir vielleicht jemand zeigen, wie ich in diesen script eine if...else... schleife einbauen kann? danke
Re: logrotate und apache mal wieder
Du kannst zum Beispiel den Exitcode von grep abfragen (0=gefunden/1=!gefunden) und entsprechend reagieren. Da ich von Perl zu wenig Ahnung habe, überlasse ich das Basteln mal Dir 8)
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Re: logrotate und apache mal wieder
na ja, habe die holzhammer-methode gewählt. verwende ein script ohne perl, dass den prozess überwacht, ggf apache killt und wieder neustartet. :roll:
gruss
toppas
gruss
toppas
