[System Administrator's Guide] Automating_System_Tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 8bcd1feb7f276bc217c3938d92017b47fe189af8 Mon Sep 17 00:00:00 2001
Author: Rashadul Islam <rashadul@xxxxxxxxxxxxxxxxx>
Date: Mon, 30 Dec 2013 19:30:12 -0500

	To up-to-date the Automating_System_Tasks; there is no privileged update in this docment.

---
 Automating_System_Tasks.xml | 447 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 447 insertions(+)
 create mode 100644 Automating_System_Tasks.xml

diff --git a/Automating_System_Tasks.xml b/Automating_System_Tasks.xml
new file mode 100644
index 0000000..3b3540f
--- /dev/null
+++ b/Automating_System_Tasks.xml
@@ -0,0 +1,447 @@
+<?xml version='1.0'?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"; [
+]>
+<chapter id="ch-Automating_System_Tasks">
+  <title>Automating System Tasks</title>
+  <indexterm significance="normal">
+    <primary>Automated Tasks</primary>
+  </indexterm>
+  <para>In Linux, tasks, which are also known as <firstterm>jobs</firstterm>, can be configured to run automatically within a specified period of time, on a specified date, or when the system load average is below a specified number. &MAJOROS; is pre-configured to run important system tasks to keep the system updated. For example, the slocate database used by the <command>locate</command> command is updated daily. A system administrator can use automated tasks to perform periodic backups, monitor the system, run custom scripts, and more.</para>
+  <para>&MAJOROS; comes with several automated tasks utilities: <command>cron</command>, <command>at</command>, and <command>batch</command>.</para>
+  <indexterm significance="normal">
+    <primary>Cron</primary>
+  </indexterm>
+  <section id="s1-autotasks-cron-anacron">
+    <title>Cron and Anacron</title>
+    <indexterm significance="normal">
+        <primary>anacron</primary>
+      </indexterm>
+      <indexterm significance="normal">
+        <primary>
+          <filename>cron</filename>
+        </primary>
+      </indexterm>
+    <para>Both, <systemitem class="daemon">Cron</systemitem> and <systemitem class="daemon">Anacron</systemitem>, are daemons that can be used to schedule the execution of recurring tasks according to a combination of the time, day of the month, month, day of the week, and week.</para>
+    <para><systemitem
+		class="daemon">Cron</systemitem> assumes that the system is on continuously. If the system is not on when a job is scheduled, it is not executed. Cron allows jobs to be run as often as every minute. Anacron does not assume the system is always on, remembers every scheduled job, and executes it the next time the system is up. However, Anacron can only run a job once a day.
+    To schedule recurring jobs, refer to <xref linkend="s2-configuring-anacron-jobs"/> or <xref linkend="s2-configuring-cron-jobs"/>. To schedule one-time jobs, refer to <xref linkend="s1-autotasks-at-batch"/>.</para>
+    <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 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>
+      <para>
+        Refer to <xref linkend="ch-Services_and_Daemons" /> for more information on how to configure services in &MAJOROS;.
+      </para>
+    </section>
+    <section id="s2-configuring-anacron-jobs">
+      <title>Configuring Anacron Jobs</title>
+      <indexterm significance="normal">
+        <primary>anacron</primary>
+        <secondary>anacron configuration file</secondary>
+      </indexterm>
+      <indexterm significance="normal">
+        <primary>
+          <filename>anacrontab</filename>
+        </primary>
+      </indexterm>
+      <indexterm
+        significance="normal">
+        <primary>anacron</primary>
+        <secondary>user-defined tasks</secondary>
+      </indexterm>
+      <indexterm
+        significance="normal">
+        <primary>
+          <filename>/var/spool/anacron</filename>
+        </primary>
+      </indexterm>
+      <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
+RANDOM_DELAY=45
+# the jobs will be started during the following hours only
+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
+@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>
+      <para>
+  The next two lines are variables that modify the time for each scheduled job. The <computeroutput>RANDOM_DELAY</computeroutput> variable denotes the maximum number of minutes that will be added to the <filename>delay in minutes</filename> variable which is specified for each job. The minimum delay value is set, by default, to 6 minutes. A <computeroutput>RANDOM_DELAY</computeroutput> set to 12 would therefore add, randomly, between 6 and 12 minutes to the <filename>delay in minutes</filename> for each job in that particular anacrontab. <computeroutput>RANDOM_DELAY</computeroutput> can also be set to a value below 6, or even 0. When set to 0, no random delay is added. This proves to be useful when, for example, more computers that share one network connection need to download the same data every day. The <computeroutput>START_HOURS_RANGE</computeroutput> variable defines an interval (in hours) when scheduled jobs can be run. In case this time interval is missed, for example
 , due to a power down, then scheduled jobs are not executed that day.
+</para>
+      <para>The rest of the lines in the <filename>/etc/anacrontab</filename> file represent scheduled jobs and have the following format:
+</para>
+      <programlisting>period in days   delay in minutes   job-identifier   command</programlisting>
+      <itemizedlist>
+        <listitem>
+          <para>
+            <computeroutput>period in days</computeroutput> — specifies the frequency of execution of a job in days. This variable can be represented by an integer or a macro (<computeroutput>@daily</computeroutput>, <computeroutput>@weekly</computeroutput>, <computeroutput>@monthly</computeroutput>), where <computeroutput>@daily</computeroutput> denotes the same value as the integer 1, <computeroutput>@weekly</computeroutput> the same as 7, and <computeroutput>@monthly</computeroutput> specifies that the job is run once a month, independent on the length of the month.
+    </para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>delay in minutes</computeroutput> — specifies the number of minutes anacron waits, if necessary, before executing a job. This variable is represented by an integer where 0 means no delay.
+    </para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>job-identifier</computeroutput> — specifies a unique name of a job which is used in the log files.
+    </para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>command</computeroutput> — specifies the command to execute. The command can either be a command such as <computeroutput>ls /proc >> /tmp/proc</computeroutput> or a command to execute a custom script.
+    </para>
+        </listitem>
+      </itemizedlist>
+      <para>Any lines that begin with a hash sign (#) are comments and are not processed.</para>
+      <section id="s3-anacron-examples">
+        <title>Examples of Anacron Jobs </title>
+        <para>The following example shows a simple <filename>/etc/anacrontab</filename> file:</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
+RANDOM_DELAY=30
+# the jobs will be started during the following hours only
+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
+@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>
+<section id="s3-disabling-anacron">
+<title>Disabling Anacron</title>
+<para>
+  In case your system is continuously on and you do not require anacron to run your scheduled jobs, you may uninstall the <filename>cronie-anacron</filename> package. Thus, you will be able to define jobs using crontabs only.
+</para>
+</section>
+      </section>
+    </section>
+    <section id="s2-configuring-cron-jobs">
+      <title>Configuring Cron Jobs</title>
+  <indexterm
+        significance="normal">
+        <primary>cron</primary>
+        <secondary>user-defined tasks</secondary>
+      </indexterm>
+      <indexterm
+        significance="normal">
+        <primary>
+          <filename>/var/spool/cron</filename>
+        </primary>
+      </indexterm>
+      <indexterm significance="normal">
+        <primary>cron</primary>
+        <secondary>cron configuration file</secondary>
+      </indexterm>
+      <indexterm significance="normal">
+        <primary>
+          <filename>crontab</filename>
+        </primary>
+      </indexterm>
+      <para>
+    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>
+      <programlisting>SHELL=/bin/bash
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+HOME=/
+# For details see man 4 crontabs
+# Example of job definition:
+# .---------------- minute (0 - 59)
+# | .------------- hour (0 - 23)
+# | | .---------- day of month (1 - 31)
+# | | | .------- 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</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>
+      <programlisting>minute   hour   day   month   day of week   user   command</programlisting>
+      <itemizedlist>
+        <listitem>
+          <para>
+            <computeroutput>minute</computeroutput> — any integer from 0 to 59</para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>hour</computeroutput> — any integer from 0 to 23</para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>day</computeroutput> — any integer from 1 to 31 (must be a valid day if a month is specified)</para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>month</computeroutput> — any integer from 1 to 12 (or the short name of the month such as jan or feb)</para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>day of week</computeroutput> — any integer from 0 to 7, where 0 or 7 represents Sunday (or the short name of the week such as sun or mon)</para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>user</computeroutput> — specifies the user under which the jobs are run
+          </para>
+        </listitem>
+        <listitem>
+          <para>
+            <computeroutput>command</computeroutput> — the command to execute (the command can either be a command such as <command>ls /proc &gt;&gt; /tmp/proc</command> or the command to execute a custom script)</para>
+        </listitem>
+      </itemizedlist>
+      <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>/<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 <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>
+        <para>
+            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 <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>
+      </note>
+    </section>
+    <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 <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 <systemitem class="username">root</systemitem> user:
+      </para>
+      <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>
+    </section>
+    <section id="s2-black-white-listing-of-cron-jobs">
+      <title>Black/White Listing of Cron Jobs</title>
+      <para>
+    Black/White listing of jobs is used to omit parts of the defined jobs that do not need to be executed. When calling the <command>run-parts</command> script on a cron folder, such as <filename>/etc/cron.daily</filename>, we can define which of the programs in this folder will not be executed by <command>run-parts</command>.
+    </para>
+    <para>To define a black list, create a <filename>jobs.deny</filename> file in the folder that <command>run-parts</command> will be executing from. For example, if we need to omit a particular program from /etc/cron.daily, then, a file <filename>/etc/cron.daily/jobs.deny</filename> has to be created. In this file, specify the names of the omitted programs from the same directory. These will not be executed when a command, such as <computeroutput>run-parts /etc/cron.daily</computeroutput>, is executed by a specific job.</para>
+    <para>To define a white list, create a <filename>jobs.allow</filename> file.</para>
+    <para>
+    The principles of <filename>jobs.deny</filename> and <filename>jobs.allow</filename> are the same as those of <filename>cron.deny</filename> and <filename>cron.allow</filename> described in section <xref linkend="s2-autotasks-cron-access"/>.
+    </para>
+    </section>
+  </section>
+  <section id="s1-autotasks-at-batch">
+    <title>At and Batch</title>
+    <indexterm significance="normal">
+      <primary>
+        <command>at</command>
+      </primary>
+    </indexterm>
+    <indexterm significance="normal">
+      <primary>
+        <command>batch</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 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>
+        </command>, where <command><replaceable>time</replaceable>
+        </command> is the time to execute the command.</para>
+      <para>The argument <replaceable>time</replaceable> can be one of the following:</para>
+      <itemizedlist>
+        <listitem>
+          <para>HH:MM format — For example, 04:00 specifies 4:00 a.m. If the time is already past, it is executed at the specified time the next day.</para>
+        </listitem>
+        <listitem>
+          <para>midnight — Specifies 12:00 a.m.</para>
+        </listitem>
+        <listitem>
+          <para>noon — Specifies 12:00 p.m.</para>
+        </listitem>
+        <listitem>
+          <para>teatime — Specifies 4:00 p.m.</para>
+        </listitem>
+        <listitem>
+          <para>month-name day year format — For example, January 15 2002 specifies the 15th day of January in the year 2002. The year is optional.</para>
+        </listitem>
+        <listitem>
+          <para>MMDDYY, MM/DD/YY, or MM.DD.YY formats — For example, 011502 for the 15th day of January in the year 2002.</para>
+        </listitem>
+        <listitem>
+          <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>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>
+          <keycap>D</keycap>
+        </keycombo> . Alternatively, a shell script can be entered at the prompt, pressing <keycap>Enter</keycap> after each line in the script, and pressing <keycombo><keycap>Ctrl</keycap>
+          <keycap>D</keycap>
+        </keycombo> on a blank line to exit. If a script is entered, the shell used is the shell set in the user's <envar>SHELL</envar> environment, the user's login shell, or <command>/bin/sh</command> (whichever is found first).</para>
+      <para>If the set of commands or script tries to display information to standard output, the output is emailed to the user.</para>
+      <para>Use the command <command>atq</command> to view pending jobs. Refer to <xref linkend="s2-autotasks-at-batch-viewing"/> for more information.</para>
+      <para>Usage of the <command>at</command> command can be restricted. For more information, refer to <xref linkend="s2-autotasks-at-batch-controlling-access"/> for details.</para>
+    </section>
+
+    <section id="s2-autotasks-batch-configuring">
+      <title>Configuring Batch Jobs</title>
+      <para>To execute a one-time task when the load average is below 0.8, use the <command>batch</command> command.</para>
+      <para>After typing the <command>batch</command> command, 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>
+          <keycap>D</keycap>
+        </keycombo> . Alternatively, a shell script can be entered at the prompt, pressing <keycap>Enter</keycap> after each line in the script, and pressing <keycombo><keycap>Ctrl</keycap>
+          <keycap>D</keycap>
+        </keycombo> on a blank line to exit. If a script is entered, the shell used is the shell set in the user's <envar>SHELL</envar> environment, the user's login shell, or <command>/bin/sh</command> (whichever is found first). As soon as the load average is below 0.8, the set of commands or script is executed.</para>
+      <para>If the set of commands or script tries to display information to standard out, the output is emailed to the user.</para>
+      <para>Use the command <command>atq</command> to view pending jobs. Refer to <xref linkend="s2-autotasks-at-batch-viewing"/> for more information.</para>
+      <para>Usage of the <command>batch</command> command can be restricted. For more information, refer to <xref linkend="s2-autotasks-at-batch-controlling-access"/> for details.</para>
+    </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 <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>
+      <para>Additional command line options for <command>at</command> and <command>batch</command> include:</para>
+      <table id="tb-at-command-line-options">
+        <title>
+          <command>at</command> and <command>batch</command> Command Line Options</title>
+        <tgroup cols="2">
+          <colspec colname="option" colnum="1" colwidth="20*"/>
+          <colspec colname="description" colnum="2" colwidth="50*"/>
+          <thead>
+            <row>
+              <entry>Option</entry>
+	      <entry>Description</entry>
+            </row>
+          </thead>
+          <tbody>
+            <row>
+              <entry>
+                <option>-f</option>
+              </entry>
+              <entry>
+		Read the commands or shell script from a file instead of specifying them at the prompt.
+	      </entry>
+            </row>
+            <row>
+              <entry>
+                <option>-m</option>
+              </entry>
+              <entry>
+		Send email to the user when the job has been completed.
+	      </entry>
+            </row>
+            <row>
+              <entry>
+                <option>-v</option>
+              </entry>
+              <entry>
+		Display the time that the job is executed.
+	      </entry>
+            </row>
+          </tbody>
+        </tgroup>
+      </table>
+    </section>
+    <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 <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 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>
+      <para>
+        Refer to <xref linkend="ch-Services_and_Daemons" /> for more information on how to configure services in &MAJOROS;.
+      </para>
+    </section>
+  </section>
+
+  <section id="s1-autotasks-additional-resources">
+    <title>Additional Resources</title>
+    <indexterm significance="normal">
+      <primary>cron</primary>
+      <secondary>additional resources</secondary>
+    </indexterm>
+    <indexterm significance="normal">
+      <primary>at</primary>
+      <secondary>additional resources</secondary>
+    </indexterm>
+    <indexterm significance="normal">
+      <primary>batch</primary>
+      <secondary>additional resources</secondary>
+    </indexterm>
+    <para>To learn more about configuring automated tasks, refer to the following resources.</para>
+
+    <section id="s2-autotasks-installed-docs">
+      <title>Installed Documentation</title>
+      <itemizedlist>
+        <listitem>
+          <para>
+            <filename>cron</filename> man page — contains an overview of cron.</para>
+        </listitem>
+        <listitem>
+          <para>
+            <filename>crontab</filename> man pages in sections 1 and 5 — The man page in section 1 contains an overview of the <filename>crontab</filename> file. The man page in section 5 contains the format for the file and some example entries.</para>
+        </listitem>
+        <listitem>
+          <para>
+            <filename>anacron</filename> man page — contains an overview of anacron.
+          </para>
+        </listitem>
+        <listitem>
+          <para>
+            <filename>anacrontab</filename> man page — contains an overview of the <filename>anacrontab</filename> file.
+          </para>
+        </listitem>
+        <listitem>
+          <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>
+            <filename>at</filename> man page — description of <command>at</command> and <command>batch</command> and their command line options.</para>
+        </listitem>
+      </itemizedlist>
+    </section>
+  </section>
+</chapter>
-- 
1.8.1.4

-- 
docs mailing list
docs@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe:
https://admin.fedoraproject.org/mailman/listinfo/docs





[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Red Hat 9]     [Yosemite News]     [KDE Users]

  Powered by Linux