IST 191 Chapter 2
The superuser can use the __ option with the crontab command to manage jobs for another user.
-u
Which job format executes /usr/local/bin/daily_backup hourly from 9a.m. to 6p.m. on all days from Monday through Friday?
00 09-18 * * Mon-Fri /usr/local/bin/daily_backup
Is the atd a default daemon
In a default RedHat EnterpriseLinux installation, the atd daemon is installed and enabled automatically
Fields in the crontab file appear in what order
Minutes Hours Day of month Month Day of week Command
at -c JOBNUMBER command
To inspect the actual commands that will run when a job is executed, use the at -c JOBNUMBER command. This command shows the environment for the job being set up to reflect the environment of the user who created the job at the time it was created, followed by the actual commands to be run.
Which configuration file defines the settings for the system jobs that run on a daily, weekly, and monthly basis?
/etc/anacrontab
Which directory contains the shell scripts intended to run on a daily basis?
/etc/cron.daily
Some applications (and users) use the _______ directory to hold temporary data, while others use a more task-specific location such as daemon and user-specific volatile directories under ___________.
/tmp; /run
The first five fields all use the same syntax rules, what are those?
1. * for Do not Care/always. 2. A number to specify a number of minutes or hours, a date, or a weekday. For weekdays, 0 equals Sunday, 1 equals Monday, 2 equals Tuesday, and so on. 7 also equals Sunday. 3. x-y for a range, x to y inclusive. 4. x,y for lists. Lists can include ranges as well, for example, 5,10-13,17 in the Minutes column to indicate that a job should run at 5, 10, 11, 12, 13, and 17 minutes past the hour. 5. */x to indicate an interval of x, for example, */7 in the Minutes column runs a job every seven minutes.
Configuration files can exist in three places:
1. /etc/tmpfiles.d/*.conf 2. /run/tmpfiles.d/*.conf 3. /usr/lib/tmpfiles.d/*.conf
The syntax of /etc/anacrontab contains exactly four fields per line
1. Period in days 2. Delay in Minutes 3. Job Identifier 4. Command
The sysstat package provides a systemd timer unit called sysstat-collect.timer to collect system statistics every ____________.
10 minutes
run-parts
A command called run-parts called from the /etc/cron.d/0hourly file runs the /etc/cron.hourly/* scripts. The run-parts command also runs the daily, weekly, and monthly jobs, but it is called from a different configuration file called /etc/anacrontab.
In the at command: at -q g teatime tomorrow When will the at job run?
At 4pm the next day
Use the Linux ___ command to Schedule Recurring Jobs
Cron
While manually entering commands, you can finish your input by pressing __________.
Ctrl+D.
What is a task or job that is going to run in the future called?
Deferred
crontab -e
Edit jobs for the current user.
recurring jobs
Jobs scheduled to run repeatedly
crontab -l
List the jobs for the current user.
crontab -r
Remove all jobs for the current user.
crontab filename
Remove all jobs, and replace with the jobs read from filename. If no file is specified, stdin is used.
How many queues does the atd daemon provide?
The atd daemon provides 26 queues, a to z, with jobs in alphabetically later queues getting lower system priority
atrm JOBNUMBER command
The atrm JOBNUMBER command removes a scheduled job. Remove the scheduled job when it is no longer needed, for example, when a remote firewall configuration succeeded, and does not need to be reset.
Which command displays all the user jobs that are currently scheduled to run as deferred jobs?
atq
When systemd starts a system, one of the first service units launched is systemd-tmpfiles-setup. This service runs what command?
This service runs the command systemd-tmpfiles --create --remove.
Who can queue jobs for the atd daemon?
Users including root can queue up jobs for the atd daemon using the at command
Which command removes the deferred user job that has the job number 5?
atrm 5
The ___ command then reads the commands to execute from the stdin channel
at
Use the Linux ___ command to Schedule one-time tasks.
at
Remember to make any script you place in these directories executable. If a script is not executable, it will not run. To make a script executable, use the __________________________________ command
chmod +x script_name
The _______ daemon reads multiple configuration files: one per user (edited with the crontab command), and a set of system-wide files.
crond
RedHat EnterpriseLinux systems ship with the __________ daemon, provided by the _______ _______________, enabled and started by default specifically for recurring jobs.
crond; cronie package
Which command displays all the recurring user jobs scheduled for the currently logged-in user?
crontab -l
at TIMESPEC command
schedule a new job
After changing the timer unit configuration file, use the ___________ ___________-_____________ command to ensure that systemd is aware of the change.
systemctl daemon-reload
RedHat EnterpriseLinux7 and later include a new tool called _________-_____________, which provides a structured and configurable method to manage temporary directories and files
systemd-tmpfiles
The command __________-____________--_______ parses the same configuration files as the systemd-tmpfiles --create command, but instead of creating files and directories, it will purge all files which have not been accessed, changed, or modified more recently than the maximum age defined in the configuration file.
systemd-tmpfiles --clean
Which systemd unit regularly triggers the cleanup of the temporary files?
systemd-tmpfiles-clean.timer
What are scheduled commands often called?
tasks or jobs
To get an overview of the pending jobs for the current user, use what commands?
the command atq or the at -l commands
If a scheduled command produces any output or error that is not redirected, the crond daemon attempts to do what?
the crond daemon attempts to email that output or error to the user who owns that job (unless overridden) using the mail server configured on the system