
Ich erlebte vor kurzem eineLogwatch-ProblemDies wird durch Ausführen behoben export DATE_MANIP=DM5
. cron scheint dies zu vergessen, wenn ich mich abmelde (vermutlich, weil es nicht gespeichert wird).
Wo kann ich diese benutzerdefinierte Umgebungsvariable hinzufügen? Da ich den Code für Logwatch nicht verwalte, möchte ich nicht unbedingt einen export
Befehl in das gestartete Skript einfügen. Ich habe versucht, export DATE_MANIP=DM5
etwas hinzuzufügen /root/.bash_profile
, aber das hilft nicht, wenn ich nicht angemeldet bin.
CentOS 6.x
Antwort1
Bearbeiten Sie Ihr /etc/cron.daily/0logwatch
Skript und fügen Sie es export DATE_MANIP=DM5
vor dem Logwatch-Aufruf hinzu.
Beispiel:
#!/bin/sh
#Set logwatch location
LOGWATCH_SCRIPT="/usr/sbin/logwatch"
#Add options to this line. Most options should be defined in /etc/logwatch/conf/logwatch.conf,
#but some are only for the nightly cronrun such as --output mail and should be set here.
#Other options to consider might be "--format html" or "--encode base64", man logwatch for more details.
OPTIONS="--output mail"
# Fix Date::Manip issue
export DATE_MANIP=DM5
#Call logwatch
$LOGWATCH_SCRIPT $OPTIONS
exit 0