Cron и vnstat

openSUSE, SUSE Linux Enterprise

Модератор: Модераторы разделов

shellen
Сообщения: 42

Cron и vnstat

Сообщение shellen »

Коллеги,

Помогите разобраться с проблемой.
На сервере стоит OpenSuse 11.4. Установлен vnstat.
Все работает, вот только, в messages постоянно вылезают записи типа:

Dec 20 15:00:01 srv /USR/SBIN/CRON[30581]: (root) CMD (if [ -x /usr/bin/vnstat ] && ! /usr/bin/killall -9 /usr/sbin/vnstatd 2>/dev/null && [ `/bin/ls -1 /var/lib/vnstat/ | wc -l` -ge 1 ]; then /bin/su -c "/usr/bin/vnstat -u" vnstat; fi)
Dec 20 15:00:01 srv su: (to vnstat) root on none
Dec 20 15:05:01 srv /USR/SBIN/CRON[30614]: (root) CMD (if [ -x /usr/bin/vnstat ] && ! /usr/bin/killall -9 /usr/sbin/vnstatd 2>/dev/null && [ `/bin/ls -1 /var/lib/vnstat/ | wc -l` -ge 1 ]; then /bin/su -c "/usr/bin/vnstat -u" vnstat; fi)

Как настроить cron или еще что, чтобы эти записи либо вообще не писались, либо писались в отдельный файл?
Спасибо сказали:
Romendakil
Сообщения: 42
ОС: openSUSE

Re: Cron и vnstat

Сообщение Romendakil »

Судя по мануалу, у crond есть две опции, которые могут повлиять на вывод в syslog: -s и -m.
-m This option allows you to specify a shell command to use for sending Cron mail output instead of using sendmail(8) This command must accept
a fully formatted mail message (with headers) on standard input and send it as a mail message to the recipients specified in the mail head‐
ers. Specifying the string off (i.e. crond -m off) will disable the sending of mail.


-s This option will direct Cron to send the job output to the system log using syslog(3). This is useful if your system does not have send‐
mail(8), installed or if mail is disabled.


То есть достаточно запускать crond без опции -s и с опцией -m вида > /dev/null, чтобы mail'ы не рассылались. Подкрутить это можно в /etc/init.d/
Спасибо сказали:
shellen
Сообщения: 42

Re: Cron и vnstat

Сообщение shellen »

Вроде разобрался. Может кому пригодится.
Направил все записи cron в /var/log/cron

В файл /etc/rsyslog.conf добавляем:

cron.* /var/log/cron


#
# the rest in one file
#
*.*;crone.none;mail.none;news.none -/var/log/messages

Спасибо сказали:
shellen
Сообщения: 42

Re: Cron и vnstat

Сообщение shellen »

Ошибочка вкралась
*.*;cron.none;mail.none;news.none -/var/log/messages

Вот так правильно.
Спасибо сказали: