<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; CentOS, logrotate: ALERT exited abnormally with [1]]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=36019&amp;type=atom" />
	<updated>2014-09-09T04:21:11Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=36019</id>
		<entry>
			<title type="html"><![CDATA[Re: CentOS, logrotate: ALERT exited abnormally with [1]]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=422059#p422059" />
			<content type="html"><![CDATA[<p>чудо-таки произошло - сегодня утром получил чёткий и понятный лог:<br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">cat /var/log/logrotate</p><p>rotating pattern: /srv/safespace/log/firewall/firewall.log&nbsp; after 1 days (31 rotations)<br />empty log files are not rotated, old logs are removed<br />considering log /srv/safespace/log/firewall/firewall.log<br />&nbsp; log needs rotating<br />rotating log /srv/safespace/log/firewall/firewall.log, log-&gt;rotateCount is 31<br />dateext suffix &#039;-20140909&#039;<br />glob pattern &#039;-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]&#039;<br /><span style="color: red">error: error accessing /srv/safespace/log/firewall: Permission denied</span><br />glob finding old rotated logs failed<br />running prerotate script<br />logrotate_script: line 1: /srv/safespace/log/firewall/stat-20140909: Permission denied<br />logrotate_script: line 2: /srv/safespace/log/firewall/stat-20140909: No such file or directory<br />error: error running non-shared prerotate script for /srv/safespace/log/firewall/firewall.log of &#039;/srv/safespace/log/firewall/firewall.log &#039;<br /></div></p><p>какие права нужно назначить на файл?<br />скрипт запускается командой из <em>anacrontab</em><br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">cat anacrontab<br /># /etc/anacrontab: configuration file for anacron</p><p># See anacron(8) and anacrontab(5) for details.</p><p>SHELL=/bin/sh<br />PATH=/sbin:/bin:/usr/sbin:/usr/bin<br />MAILTO=root<br /># the maximal random delay added to the base delay of the jobs<br />RANDOM_DELAY=30<br /># the jobs will be started during the following hours only<br />START_HOURS_RANGE=1-3</p><p>#period in days delay in minutes&nbsp; &nbsp; &nbsp; &nbsp; job-identifier&nbsp; command<br /><span style="color: yellow">1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cron.daily&nbsp; &nbsp; &nbsp; nice run-parts /etc/cron.daily</span><br />7&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;25&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cron.weekly&nbsp; &nbsp; &nbsp;nice run-parts /etc/cron.weekly<br />@monthly&nbsp; &nbsp; &nbsp; &nbsp; 45&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cron.monthly&nbsp; &nbsp; nice run-parts /etc/cron.monthly<br /></div></p>]]></content>
			<author>
				<name><![CDATA[Sirius Dour]]></name>
				<uri>https://linuxforum.ru/profile.php?id=35304</uri>
			</author>
			<updated>2014-09-09T04:21:11Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=422059#p422059</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CentOS, logrotate: ALERT exited abnormally with [1]]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=422017#p422017" />
			<content type="html"><![CDATA[<p>Да эт я знаю, просто вроде бы раньше <em>CentOS 6.3</em> писало. Может с памятью у меня чего. Завтра на других машинах проверю (дистрибутив то один).</p><p>А по теме: открыл для себя, что помимо <em>crontab</em>-а есть еще и <em>anacrontab</em>, и вот в нём-то и прописано время запуска <em>logrotate</em>. Может кому полезно будет.<br />Проблему со скриптом так и не решил. Надеюсь мои манипуляции всё-таки выдадут мне завтра какой-нибудь лог файл с ошибками. Гугл говорит, что по умолчанию <em>anacrontab</em> запускает от пользователя <em>root</em>, тогда не понятна причина ошибки, т.к. руками я тоже запускаю от <em>root</em></p>]]></content>
			<author>
				<name><![CDATA[Sirius Dour]]></name>
				<uri>https://linuxforum.ru/profile.php?id=35304</uri>
			</author>
			<updated>2014-09-08T16:55:24Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=422017#p422017</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: CentOS, logrotate: ALERT exited abnormally with [1]]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=422006#p422006" />
			<content type="html"><![CDATA[<p><strong>Sirius Dour</strong>, CentOS тот же Red Hat Enterprise Linux, только без подписки на техподдержку <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /></p>]]></content>
			<author>
				<name><![CDATA[Wolfenberg]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9425</uri>
			</author>
			<updated>2014-09-08T16:06:30Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=422006#p422006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[CentOS, logrotate: ALERT exited abnormally with [1]]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=421942#p421942" />
			<content type="html"><![CDATA[<p>Возможно ли получить более подробный лог для устранения ошибки при ротировании логов?</p><p><strong>Суть.</strong><br />Добавил новое правило ротирования в <em>/etc/logrotate.d</em><br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">cat /etc/logrotate.d/firewall</p><p>/srv/safespace/log/firewall/firewall.log {<br />&nbsp; &nbsp; daily<br />&nbsp; &nbsp; missingok<br />&nbsp; &nbsp; rotate 31<br />&nbsp; &nbsp; compress<br />&nbsp; &nbsp; notifempty<br />&nbsp; &nbsp; copytruncate<br />&nbsp; &nbsp; prerotate<br />&nbsp; &nbsp; &nbsp; &nbsp; cat /srv/safespace/log/firewall/firewall.log | awk &#039;{print $11}&#039; | sort | uniq -c &gt; /srv/safespace/log/firewall/stat-$(date +%Y%m%d)<br />&nbsp; &nbsp; &nbsp; &nbsp; mail -s &quot;IP to block $(date +%d.%m.%Y)&quot; test@my_serv.ru &lt; /srv/safespace/log/firewall/stat-$(date +%Y%m%d)<br />&nbsp; &nbsp; endscript<br />}</div></p><p>При &quot;ручном запуске&quot; (<em>logrotate -v /etc/logrotate.conf</em>) все отрабатывает корректно: создает архив, файл статистики, приходит письмо на почту.<br />При &quot;автоматическом&quot; я получаю <em>logrotate: ALERT exited abnormally with [1]</em> в <em>/var/log/messages</em> и больше ничего<br />Есть подозрение, что для выполнения скрипта в prerotate не хватает каких-то полномочий. Как бы это выяснить?</p><p><strong>P.S.</strong> судя по времени создания архивов ротирование происходит в ~3:40. Как изменить это время? скрипт запуска logrotate поменял (как я думаю) на генерацию лог файла. Он находится в <em>/etc/cron.daily/</em><br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">cat /etc/cron.daily/logrotate</p><p>#!/bin/sh</p><p>/usr/sbin/logrotate -v /etc/logrotate.conf &gt;<strong><span style="color: red">/var/log/logrotate</span></strong> 2&gt;&amp;1<br />EXITVALUE=$?<br />if [ $EXITVALUE != 0 ]; then<br />&nbsp; &nbsp; /usr/bin/logger -t logrotate &quot;ALERT exited abnormally with [$EXITVALUE]&quot;<br />fi<br />exit 0</div></p><p>(ранее там было <em>/dev/null</em>)</p><p><strong>P.P.S.</strong><br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">cat /etc/redhat-release<br />Red Hat Enterprise Linux Server release 6.3 (Santiago)<br /></div><br />0_о ставил-то вроде CentOS</p>]]></content>
			<author>
				<name><![CDATA[Sirius Dour]]></name>
				<uri>https://linuxforum.ru/profile.php?id=35304</uri>
			</author>
			<updated>2014-09-08T09:56:48Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=421942#p421942</id>
		</entry>
</feed>
