RH134 v8.2 CH2 Part 1: Cron (Scheduling Recurring Jobs)

Ace your homework & exams now with Quizwiz!

Which time/date field has the asterisk in it? * 1 1 1 1

Minute (expressed as a number between 0-59) 0 = top of hour

Name the six fields provided by crontab

Minutes Hours Day of Month Month Day of week Command(s) you need to run

In which of the following directories would you put system wide crontab files? /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

/etc/cron.d

In which of the following directories would you put shell scripts? /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

/etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

What does the */5 in the third field represent? 1 1 */5 1 1

5 day intervals The asterisk means that the cron will fire on intervals of that value. In this case the value is every 5 days.

Name the six most common macros (shortcuts) you can use instead of the 5 ( * * * * *) time/date fields?

@yearly (this replaces 0 0 1 1 *) @monthy (replaces 0 0 1 * *) @weekly (replaces 0 0 * * 0) @daily (replaces 0 0 * * *) @hourly (replaces 0 * * * *) @reboot (runs cron job when systems is rebooted)

What does the 1-5 in the fifth field represent? * * * * 1-5

A range of days of week, starting at Monday and ending on Friday. A range is two numbers separated by a hyphen

What does the 1, 10, 25in the third field represent? * * 1, 10, 25, * *

A list of days in the month(s). The 1st, 10th, and the 25th A list is a set of numbers or ranges separated by commas

What does the asterisk (*) represent when used in a time/date field?

All possible values in that field

Which time/date field has the asterisk in it? 1 1 * 1 1

Day of month (expressed as a number between 1 -31)

Which time/date field has the asterisk in it? 1 1 1 1 *

Day of week ( can be expressed as a number between 0-7, or as name of day: Mon, Tue and so on ) You can use either abbreviated name of day or number sun = 0 or 7 mon = 1 tue = 2 wed = 3 thu = 4 fri = 5 sat = 6

Based on the information below, when is the logger job scheduled to run? */5 9-16 * Jul 5 logger "Hello"

Every five minutes between 9AM and 5PM, on every Friday in July

Based on the information below, when is the logger job scheduled to run? 58 23 * * 1-5 logger "Hello"

Every weekday at two minutes before midnight

Based on the information below, when is the logger job scheduled to run? 0 9 * * 1-5 logger "Hello"

Every workday (Monday to Friday), at 9AM

Which time/date field has the asterisk in it? 1 * 1 1 1

Hour (expressed as a number between 0-23) 0 = 12 am 23 = 11 pm

Which time/date field has the asterisk in it? 1 1 1 * 1

Month ( expressed as a number between 1- 12, or abbreviated name. For example: Jan, Feb. . . etc)

Name two common variables setting you may find in cron jobs are?

SHELL and MAILTO

Based on the information below, when is the logger job scheduled to run? 15 12 15 * Fri logger "Hello"

The 15th of every month, and every Friday at 12:15PM

What is the function of the /etc/anacrontab file?

The crond service uses the settings in /etc/anacrontab to monitor the crontab sub directories (see below) to make sure the jobs in those directories are always run and not skipped /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

What is the difference between user and system cron jobs?

User cron jobs are created with the crontab -e command and are owned by the account that created it. User cron jobs contain 6 fields: * * * * * command System cron jobs are NOT created using crontab. Instead, you use an editor to create a file in cron format and save it in /etc/cron.d. System cron jobs have 7 fields: * * * * * username command

Edit (or create) jobs for the current user

crontab -e

List cron jobs for your user account

crontab -l

Remove all cron jobs for your user account

crontab -r

Which command would allow root to edit a cron job for a another user?

crontab -u username -e

Which command would allow root to list cron jobs for a another user?

crontab -u username -l

Which command would allow root to remove a cron job for a another user?

crontab -u username -r

Which man page has a good explanation of the time/date fields used with crontab?

man 5 crontab

What command runs the scripts located in the cron.hourly, cron.daily, cron.weekly, and cron.monthly directories?

run-parts

What is the default editor for crontab jobs?

vim


Related study sets

Unit 4 Chapter 34 Quiz Globalization and Protectionism

View Set

Exam 3 Review- Environmental Science

View Set

Economics // Chapter 8 Content // Aggregate Expenditures

View Set

C 207 Data Driven Decision Making

View Set

World Geography A - Unit 1 (Primavera - Online)

View Set

Issues Related to Pediatric Health

View Set

Med-Surg I: ATI Practice Cardiovascular

View Set