Changeset 0f7ad57


Ignore:
Timestamp:
07/05/2019 07:25:15 AM (3 years ago)
Author:
DJ Lucas <dj@…>
Branches:
10.0, 10.1, 11.0, 11.1, 9.0, 9.1, lazarus, qt5new, trunk, upgradedb, xry111/intltool, xry111/test-20220226
Children:
9a121c0
Parents:
da39a659
Message:

Use cron.daily or systemd timer to start logrotate daily.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@21805 af4574ff-66df-0310-9fd7-8a98e5e911e0

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • general/sysutils/logrotate.xml

    rda39a659 r0f7ad57  
    7878    </para>
    7979
    80     <bridgehead renderas="sect4">Recommended</bridgehead>
    81     <para role="recommended">
     80    <bridgehead renderas="sect4" revision="sysv">Recommended</bridgehead>
     81    <para role="recommended" revision="sysv">
    8282      <xref role="runtime" linkend="fcron"/> (runtime)
    8383    </para>
     
    223223  because they are not actually created.</para>
    224224
    225   <para>To set up <xref linkend='fcron'/> to run
    226   <command>logrotate ...</command> at 3AM daily, root's crontab should be
    227   edited to add:</para>
    228 
    229 <screen><literal>0 3 * * *   /usr/sbin/logrotate /etc/logrotate.conf</literal></screen>
    230 
     225    <para>
     226      To run the <command>logrotate</command> daily,
     227      <phrase revision="sysv">if you've installed
     228      <xref linkend="fcron"/> and completed the section on periodic jobs,
     229      execute</phrase><phrase revision="systemd">execute</phrase> the following
     230      commands, as the  <systemitem class="username">root</systemitem> user,
     231      to create a <phrase revision="sysv">daily cron job:</phrase>
     232      <phrase revision="systemd">systemd timer to run daily at 3:00 A.M.
     233     (local time):</phrase>
     234    </para>
     235
     236<screen role="root" revision="sysv"><userinput>cat &gt; /etc/cron.daily/logrotate.sh &lt;&lt; "EOF" &amp;&amp;
     237<literal>#!/bin/bash
     238/usr/sbin/logrotate /etc/logrotate.conf</literal>
     239EOF
     240chmod 754 /etc/cron.daily/logrotate.sh</userinput></screen>
     241
     242<screen role="root" revision="systemd"><userinput>cat &gt; /lib/systemd/system/logrotate.service &lt;&lt; "EOF" &amp;&amp;
     243<literal>[Unit]
     244Description=Runs the logrotate command
     245Documentation=logrotate(8)
     246DefaultDependencies=no
     247After=local-fs.target
     248Before=shutdown.target
     249
     250[Service]
     251Type=oneshot
     252RemainAfterExit=yes
     253ExecStart=/usr/sbin/logrotate /etc/logrotate.conf</literal>
     254EOF
     255cat &gt; /lib/systemd/system/logroate.timer &lt;&lt; "EOF" &amp;&amp;
     256<literal>[Unit]
     257Description=Runs the logrotate command daily at 3:00 AM
     258
     259[Timer]
     260OnCalendar=*-*-* 3:00:00
     261Persistent=true
     262
     263[Install]
     264WantedBy=timers.target</literal>
     265EOF
     266systemctl enable logrotate.timer</userinput></screen>
    231267
    232268  </sect2>
  • introduction/welcome/changelog.xml

    rda39a659 r0f7ad57  
    4949          <para>[dj] - Add Polkit as a runtime dependency for
    5050          Xorg-Server and remove --enable-install-setuid switch.</para>
     51        </listitem>
     52        <listitem>
     53          <para revision="sysv">[dj] - Use cron.daily for logrotate cron
     54          job.</para>
     55          <para revision="systemd">[dj] - Add daily systemd timer for
     56          logrotate.</para>
    5157        </listitem>
    5258      </itemizedlist>
Note: See TracChangeset for help on using the changeset viewer.