[deployment-guide] Updated the "Automating System Tasks" chapter for Fedora 15.

Jaromir Hradilek jhradile at fedoraproject.org
Mon May 23 17:42:42 UTC 2011


commit 1cdcaf075ee60fc7e0c9883755e7081a5921d69b
Author: Jaromir Hradilek <jhradile at redhat.com>
Date:   Mon May 23 19:40:01 2011 +0200

    Updated the "Automating System Tasks" chapter for Fedora 15.

 en-US/Automating_System_Tasks.xml |   77 ++++++++++++++++++++-----------------
 1 files changed, 42 insertions(+), 35 deletions(-)
---
diff --git a/en-US/Automating_System_Tasks.xml b/en-US/Automating_System_Tasks.xml
index c3cb6a5..de41b4c 100644
--- a/en-US/Automating_System_Tasks.xml
+++ b/en-US/Automating_System_Tasks.xml
@@ -27,7 +27,17 @@
     <para>To use the cron service, the <filename>cronie</filename> RPM package must be installed and the <command>crond</command> service must be running. <filename>anacron</filename> is a sub-package of <filename>cronie</filename>. To determine if these packages are installed, use the <command>rpm -q cronie cronie-anacron</command> command. </para>
     <section id="s2-autotasks-cron-service">
       <title>Starting and Stopping the Service</title>
-      <para>To determine if the service is running, use the command <command>/sbin/service crond status</command>. To start the cron service, use the command <command>/sbin/service crond start</command>. To stop the service, use the command <command>/sbin/service crond stop</command>. It is recommended that you start the service at boot time. Refer to <xref linkend="ch-Services_and_Daemons" /> for details on starting the cron service automatically at boot time.</para>
+      <para>To determine if the service is running, use the following command:</para>
+      <screen><command>systemctl is-active crond.service</command></screen>
+      <para>To start the cron service, type the following at a shell prompt as <systemitem class="username">root</systemitem>:</para>
+      <screen><command>systemctl start crond.service</command></screen>
+      <para>To stop the service, run the following command as <systemitem class="username">root</systemitem>:</para>
+      <screen><command>systemctl stop crond.service</command></screen>
+      <para>It is recommended that you start the service at boot time. To do so, use the following command as <systemitem class="username">root</systemitem>:</para>
+      <screen><command>systemctl enable crond.service</command></screen>
+      <!-- jhradile: TBD F15: Uncomment the following line as soon as the Services and Daemons chapter is updated.
+      </para>Refer to <xref linkend="ch-Services_and_Daemons" /> for details on starting the cron service automatically at boot time.</para>
+      -->
     </section>
     <section id="s2-configuring-anacron-jobs">
       <title>Configuring Anacron Jobs</title>
@@ -51,9 +61,8 @@
           <filename>/var/spool/anacron</filename>
         </primary>
       </indexterm>
-      <para>The main configuration file to schedule jobs is <filename>/etc/anacrontab</filename> (only root is allowed to modify this file), which contains the following lines:</para>
-      <screen>
-SHELL=/bin/sh
+      <para>The main configuration file to schedule jobs is <filename>/etc/anacrontab</filename> (only <systemitem class="username">root</systemitem> is allowed to modify this file), which contains the following lines:</para>
+      <programlisting>SHELL=/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
 # the maximal random delay added to the base delay of the jobs
@@ -64,8 +73,7 @@ START_HOURS_RANGE=3-22
 #period in days   delay in minutes   job-identifier   command
 1         5     cron.daily    nice run-parts /etc/cron.daily
 7         25    cron.weekly   nice run-parts /etc/cron.weekly
- at monthly  45    cron.monthly  nice run-parts /etc/cron.monthly
-</screen>
+ at monthly  45    cron.monthly  nice run-parts /etc/cron.monthly</programlisting>
       <para>
   The first three lines are variables used to configure the environment in which the anacron tasks are run. The <computeroutput>SHELL</computeroutput> variable tells the system which shell environment to use (in this example the bash shell). The <computeroutput>PATH</computeroutput> variable defines the path used to execute commands. The output of the anacron jobs are emailed to the username defined with the <computeroutput>MAILTO</computeroutput> variable. If the <computeroutput>MAILTO</computeroutput> variable is not defined, (i.e. is empty, <computeroutput>MAILTO=</computeroutput>), email is not sent.
 </para>
@@ -74,9 +82,7 @@ START_HOURS_RANGE=3-22
 </para>
       <para>The rest of the lines in the <filename>/etc/anacrontab</filename> file represent scheduled jobs and have the following format:
 </para>
-      <screen>
-period in days   delay in minutes   job-identifier   command
-</screen>
+      <programlisting>period in days   delay in minutes   job-identifier   command</programlisting>
       <itemizedlist>
         <listitem>
           <para>
@@ -103,8 +109,7 @@ period in days   delay in minutes   job-identifier   command
       <section id="s3-anacron-examples">
         <title>Examples of Anacron Jobs </title>
         <para>The following example shows a simple <filename>/etc/anacrontab</filename> file:</para>
-        <screen>
-SHELL=/bin/sh
+        <programlisting>SHELL=/bin/sh
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
 
@@ -116,8 +121,7 @@ START_HOURS_RANGE=16-20
 #period in days   delay in minutes   job-identifier   command
 1         20    dailyjob      nice run-parts /etc/cron.daily
 7         25    weeklyjob     /etc/weeklyjob.bash
- at monthly  45    monthlyjob    ls /proc >> /tmp/proc
-</screen>
+ at monthly  45    monthlyjob    ls /proc >> /tmp/proc</programlisting>
         <para>
   All jobs defined in this <filename>anacrontab</filename> file are randomly delayed by 6-30 minutes and can be executed between 16:00 and 20:00. Thus, the first defined job will run anywhere between 16:26 and 16:50 every day. The command specified for this job will execute all present programs in the <filename>/etc/cron.daily</filename> directory (using the <command>run-parts</command> script which takes a directory as a command-line argument and sequentially executes every program within that directory). The second specified job will be executed once a week and will execute the <filename>weeklyjob.bash</filename> script in the <filename>/etc</filename> directory. The third job is executed once a month and runs a command to write the contents of the <filename>/proc</filename> to the <filename>/tmp/proc</filename> file (e.g. <computeroutput>ls /proc >> /tmp/proc</computeroutput>).
 </para>
@@ -152,10 +156,9 @@ START_HOURS_RANGE=16-20
         </primary>
       </indexterm>
       <para>
-    The configuration file to configure cron jobs, <filename>/etc/crontab</filename> (only root is allowed to modify this file), contains the following lines:
+    The configuration file to configure cron jobs, <filename>/etc/crontab</filename> (only <systemitem class="username">root</systemitem> is allowed to modify this file), contains the following lines:
   </para>
-      <screen>
-SHELL=/bin/bash
+      <programlisting>SHELL=/bin/bash
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
 HOME=/
@@ -167,17 +170,14 @@ HOME=/
 # | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
 # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
 # | | | | |
-# * * * * * user command to be executed
-  </screen>
+# * * * * * user command to be executed</programlisting>
       <para>
     The first three lines contain the same variables as an <filename>anacrontab</filename> file, <computeroutput>SHELL</computeroutput>, <computeroutput>PATH</computeroutput> and <computeroutput>MAILTO</computeroutput>. For more information about these variables, refer to <xref linkend="s2-configuring-anacron-jobs"/>. The fourth line contains the <computeroutput>HOME</computeroutput> variable. The <computeroutput>HOME</computeroutput> variable can be used to set the home directory to use when executing commands or scripts.
   </para>
       <para>
     The rest of the lines in the <filename>/etc/crontab</filename> file represent scheduled jobs and have the following format:
   </para>
-      <screen>
-minute   hour   day   month   day of week   user   command
-  </screen>
+      <programlisting>minute   hour   day   month   day of week   user   command</programlisting>
       <itemizedlist>
         <listitem>
           <para>
@@ -212,9 +212,9 @@ minute   hour   day   month   day of week   user   command
       <para>For any of the above values, an asterisk (*) can be used to specify all valid values. For example, an asterisk for the month value means execute the command every month within the constraints of the other values.</para>
       <para>A hyphen (-) between integers specifies a range of integers. For example, <userinput>1-4</userinput> means the integers 1, 2, 3, and 4.</para>
       <para>A list of values separated by commas (,) specifies a list. For example, <userinput>3, 4, 6, 8</userinput> indicates those four specific integers.</para>
-      <para>The forward slash (/) can be used to specify step values. The value of an integer can be skipped within a range by following the range with <userinput>/&lt;<replaceable>integer</replaceable>&gt;</userinput>. For example, <userinput>0-59/2</userinput> can be used to define every other minute in the minute field. Step values can also be used with an asterisk. For instance, the value <userinput>*/3</userinput> can be used in the month field to run the task every third month.</para>
+      <para>The forward slash (/) can be used to specify step values. The value of an integer can be skipped within a range by following the range with <userinput>/<replaceable>integer</replaceable></userinput>. For example, <userinput>0-59/2</userinput> can be used to define every other minute in the minute field. Step values can also be used with an asterisk. For instance, the value <userinput>*/3</userinput> can be used in the month field to run the task every third month.</para>
       <para>Any lines that begin with a hash sign (#) are comments and are not processed.</para>
-      <para>Users other than root can configure cron tasks by using the <command>crontab</command> utility. All user-defined crontabs are stored in the <filename>/var/spool/cron/</filename> directory and are executed using the usernames of the users that created them. To create a crontab as a user, login as that user and type the command <command>crontab -e</command> to edit the user's crontab using the editor specified by the <computeroutput>VISUAL</computeroutput> or <computeroutput>EDITOR</computeroutput> environment variable. The file uses the same format as <filename>/etc/crontab</filename>. When the changes to the crontab are saved, the crontab is stored according to username and written to the file <filename>/var/spool/cron/<replaceable>username</replaceable>
+      <para>Users other than <systemitem class="username">root</systemitem> can configure cron tasks by using the <command>crontab</command> utility. All user-defined crontabs are stored in the <filename>/var/spool/cron/</filename> directory and are executed using the usernames of the users that created them. To create a crontab as a user, login as that user and type the command <command>crontab -e</command> to edit the user's crontab using the editor specified by the <computeroutput>VISUAL</computeroutput> or <computeroutput>EDITOR</computeroutput> environment variable. The file uses the same format as <filename>/etc/crontab</filename>. When the changes to the crontab are saved, the crontab is stored according to username and written to the file <filename>/var/spool/cron/<replaceable>username</replaceable>
         </filename>. To list the contents of your own personal crontab file, use the <command>crontab -l</command> command. </para>
       <note>
         <title>Do not specify a user</title>
@@ -222,7 +222,7 @@ minute   hour   day   month   day of week   user   command
             When using the <command>crontab</command> utility, there is no need to specify a user when defining a job.
           </para>
       </note>
-      <para>The <filename>/etc/cron.d/</filename> directory contains files that have the same syntax as the <filename>/etc/crontab</filename> file. Only root is allowed to create and modify files in this directory.</para>
+      <para>The <filename>/etc/cron.d/</filename> directory contains files that have the same syntax as the <filename>/etc/crontab</filename> file. Only <systemitem class="username">root</systemitem> is allowed to create and modify files in this directory.</para>
       <note>
         <title>Do not restart the daemon to apply the changes</title>
         <para>The cron daemon checks the <filename>/etc/anacrontab</filename> file, the <filename>/etc/crontab</filename> file, the <filename>/etc/cron.d/</filename> directory, and the <filename>/var/spool/cron/</filename> directory every minute for any changes. If any changes are found, they are loaded into memory. Thus, the daemon does not need to be restarted if an anacrontab or a crontab file is changed.</para>
@@ -231,14 +231,12 @@ minute   hour   day   month   day of week   user   command
     <section id="s2-autotasks-cron-access">
       <title>Controlling Access to Cron</title>
       <para>The <filename>/etc/cron.allow</filename> and <filename>/etc/cron.deny</filename> files are used to restrict access to cron. The format of both access control files is one username on each line. Whitespace is not permitted in either file. The cron daemon (<command>crond</command>) does not have to be restarted if the access control files are modified. The access control files are checked each time a user tries to add or delete a cron job.</para>
-      <para>The root user can always use cron, regardless of the usernames listed in the access control files.</para>
+      <para>The <systemitem class="username">root</systemitem> user can always use cron, regardless of the usernames listed in the access control files.</para>
       <para>If the file <filename>cron.allow</filename> exists, only users listed in it are allowed to use cron, and the <filename>cron.deny</filename> file is ignored.</para>
       <para>If <filename>cron.allow</filename> does not exist, users listed in <filename>cron.deny</filename> are not allowed to use cron.</para>
-      <para>Access can also be controlled through Pluggable Authentication Modules (PAM). These settings are stored in <filename>/etc/security/access.conf</filename>. For example, adding the following line in this file forbids creating crontabs for all users except the root user:
+      <para>Access can also be controlled through Pluggable Authentication Modules (PAM). These settings are stored in <filename>/etc/security/access.conf</filename>. For example, adding the following line in this file forbids creating crontabs for all users except the <systemitem class="username">root</systemitem> user:
       </para>
-      <screen>
--:ALL EXCEPT root :cron
-</screen>
+      <programlisting>-:ALL EXCEPT root :cron</programlisting>
       <para>
         The forbidden jobs are logged in an appropriate log file or, when using “crontab -e”, returned to the standard output. For more information, refer to <filename>access.conf.5</filename> (i.e. <command>man 5 access.conf</command>).
       </para>
@@ -268,7 +266,8 @@ minute   hour   day   month   day of week   user   command
       </primary>
     </indexterm>
     <para>While cron is used to schedule recurring tasks, the <command>at</command> command is used to schedule a one-time task at a specific time and the <command>batch</command> command is used to schedule a one-time task to be executed when the systems load average drops below 0.8.</para>
-    <para>To use <command>at</command> or <command>batch</command>, the <filename>at</filename> RPM package must be installed, and the <command>atd</command> service must be running. To determine if the package is installed, use the <command>rpm -q at</command> command. To determine if the service is running, use the command <command>/sbin/service atd status</command>.</para>
+    <para>To use <command>at</command> or <command>batch</command>, the <filename>at</filename> RPM package must be installed, and the <command>atd</command> service must be running. To determine if the package is installed, use the <command>rpm -q at</command> command. To determine if the service is running, use the following command:</para>
+    <screen><command>systemctl is-active atd.service</command></screen>
     <section id="s2-autotasks-at-configuring">
       <title>Configuring At Jobs</title>
       <para>To schedule a one-time job at a specific time, type the command <command>at <replaceable>time</replaceable>
@@ -298,7 +297,7 @@ minute   hour   day   month   day of week   user   command
           <para>now + time — time is in minutes, hours, days, or weeks. For example, now + 5 days specifies that the command should be executed at the same time five days from now.</para>
         </listitem>
       </itemizedlist>
-      <para>The time must be specified first, followed by the optional date. For more information about the time format, read the <filename>/usr/share/doc/at-<replaceable>&lt;version&gt;</replaceable>/timespec</filename> text file.</para>
+      <para>The time must be specified first, followed by the optional date. For more information about the time format, read the <filename>/usr/share/doc/at-<replaceable>version</replaceable>/timespec</filename> text file.</para>
       <para>After typing the <command>at</command> command with the time argument, the <prompt>at&gt;</prompt> prompt is displayed. Type the command to execute, press <keycap>Enter</keycap>, and press <keycombo><keycap>Ctrl</keycap>
           <keycap>D</keycap>
         </keycombo> . Multiple commands can be specified by typing each command followed by the <keycap>Enter</keycap> key. After typing all the commands, press <keycap>Enter</keycap> to go to a blank line and press <keycombo><keycap>Ctrl</keycap>
@@ -326,7 +325,7 @@ minute   hour   day   month   day of week   user   command
     </section>
     <section id="s2-autotasks-at-batch-viewing">
       <title>Viewing Pending Jobs</title>
-      <para>To view pending <command>at</command> and <command>batch</command> jobs, use the <command>atq</command> command. The <command>atq</command> command displays a list of pending jobs, with each job on a line. Each line follows the job number, date, hour, job class, and username format. Users can only view their own jobs. If the root user executes the <command>atq</command> command, all jobs for all users are displayed.</para>
+      <para>To view pending <command>at</command> and <command>batch</command> jobs, use the <command>atq</command> command. The <command>atq</command> command displays a list of pending jobs, with each job on a line. Each line follows the job number, date, hour, job class, and username format. Users can only view their own jobs. If the <systemitem class="username">root</systemitem> user executes the <command>atq</command> command, all jobs for all users are displayed.</para>
     </section>
     <section id="s2-autotasks-commandline-options">
       <title>Additional Command Line Options</title>
@@ -379,13 +378,21 @@ minute   hour   day   month   day of week   user   command
     <section id="s2-autotasks-at-batch-controlling-access">
       <title>Controlling Access to At and Batch</title>
       <para>The <filename>/etc/at.allow</filename> and <filename>/etc/at.deny</filename> files can be used to restrict access to the <command>at</command> and <command>batch</command> commands. The format of both access control files is one username on each line. Whitespace is not permitted in either file. The <command>at</command> daemon (<command>atd</command>) does not have to be restarted if the access control files are modified. The access control files are read each time a user tries to execute the <command>at</command> or <command>batch</command> commands.</para>
-      <para>The root user can always execute <command>at</command> and <command>batch</command> commands, regardless of the access control files.</para>
+      <para>The <systemitem class="username">root</systemitem> user can always execute <command>at</command> and <command>batch</command> commands, regardless of the access control files.</para>
       <para>If the file <filename>at.allow</filename> exists, only users listed in it are allowed to use <command>at</command> or <command>batch</command>, and the <filename>at.deny</filename> file is ignored.</para>
       <para>If <filename>at.allow</filename> does not exist, users listed in <filename>at.deny</filename> are not allowed to use <command>at</command> or <command>batch</command>.</para>
     </section>
     <section id="s2-autotasks-at-batch-service">
       <title>Starting and Stopping the Service</title>
-      <para>To start the <command>at</command> service, use the command <command>/sbin/service atd start</command>. To stop the service, use the command <command>/sbin/service atd stop</command>. It is recommended that you start the service at boot time. Refer to <xref linkend="ch-Services_and_Daemons" /> for details on starting the cron service automatically at boot time.</para>
+      <para>To start the <command>at</command> service, use the following command as <systemitem class="username">root</systemitem>:</para>
+      <screen><command>systemctl start atd.service</command></screen>
+      <para>To stop the service, as <systemitem class="username">root</systemitem>, type the following at a shell prompt:</para>
+      <screen><command>systemctl stop atd.service</command></screen>
+      <para>It is recommended that you start the service at boot time. To do so, run the following command as <systemitem class="username">root</systemitem>:</para>
+      <screen><command>systemctl enable atd.service</command></screen>
+      <!-- jhradilek: TBD F15: Uncomment the following line as soon as the Services and Daemons chapter is updated.
+      <para>Refer to <xref linkend="ch-Services_and_Daemons" /> for details on starting the cron service automatically at boot time.</para>
+      -->
     </section>
   </section>
   <section id="s1-autotasks-additional-resources">
@@ -426,7 +433,7 @@ minute   hour   day   month   day of week   user   command
         </listitem>
         <listitem>
           <para>
-            <filename>/usr/share/doc/at-<replaceable>&lt;version&gt;</replaceable>/timespec</filename> contains more detailed information about the times that can be specified for cron jobs.</para>
+            <filename>/usr/share/doc/at-<replaceable>version</replaceable>/timespec</filename> contains more detailed information about the times that can be specified for cron jobs.</para>
         </listitem>
         <listitem>
           <para>


More information about the docs-commits mailing list