CHAPTER 11. Scheduling Tasks Flashcards

1
Q

Which of the following commands enables you to check the current status of the crond service?

a. service crond status
b. systemctl status crond
c. /usr/sbin/crond –status
d. chkconfig crond –show

A

B.

The systemctl command on RHEL 8 is used to manage services. If used with the status option, the current state of the service is checked, and recent log messages about the service are displayed as well. The name of the service to check in this case is crond.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following would run a cron task Sunday at 11 a.m.?

a. * 11 7 * *
b. 0 11 * 7 *
c. 0 11 * * 7
d. 11 0 * 7 *

A

C.

The fields in cron timing are minute, hour, day of month, month, and day of week. Answer C matches this pattern to run the task on the seventh day of the week at 11 a.m.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following launches a job every five minutes from Monday through Friday?

a. */5 * * * 1-5
b. */5 * 1-5 * *
c. 0/5 * * * 1-5
d. 0/5 * 1-5 * *

A

A.

To launch a job from Monday through Friday, you should use 1-5 in the last part of the time indicator. The minute indicator */5 will launch the job every five minutes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you create a cron job for a specific user?

a. Log in as that user and type crontab -e to open the cron editor.
b. Open the crontab file in the user home directory and add what you want to add.
c. As root, type crontab -e username.
d. As root, type crontab -u username -e.

A

A and D.

You cannot modify user cron files directly, but have to go through the crontab editor. This editor is started with the crontab -e command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which directory is mainly used by cron files that are installed automatically through RPM?

a. /etc/crond.d
b. /etc/cron.d
c. /var/cron
d. /var/spool/cron

A

B.

The /etc/cron.d directory is used to store cron files for individual services that need tasks to be executed through cron. This directory is mostly filled by installing RPM files that contain cron jobs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following is not a recommended way to specify jobs that should be executed with cron?

a. Modify /etc/crontab.
b. Put the jobs in separate scripts in /etc/cron.d.
c. Use crontab -e to create user-specific cron jobs.
d. Put scripts in /etc/cron.{hourly|daily|weekly|monthly} for automatic execution.

A

A.

Although cron jobs that are added to /etc/crontab will be executed, the /etc/crontab file is considered a system file that should not be modified directly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which service takes care of executing cron jobs in /etc/cron.hourly, cron.daily, cron.weekly, and cron.monthly?

a. cron
b. crontab
c. atd
d. anacron

A

D.

anacron is a service that takes care of executing jobs on a regular basis where it is not necessary to specify a specific time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the statements about cron security is true?

a. By default, all users are allowed to schedule tasks through cron because the /etc/cron.allow file has the keyword all in it.
b. If the cron.deny file exists, a cron.allow file must be created also and list users who are allowed to schedule tasks through cron.
c. For every user, a matching entry must exist in either the cron.allow file or the cron.deny file.
d. If the cron.allow file exists, a user must be listed in it to be able to schedule jobs through cron.

A

D. By default, the cron.allow file does not exist. If it exists, a user must be listed
in it in order to program cron jobs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

After entering commands in the at shell, which command enables you to close the at shell?

a. Ctrl-V
b. Ctrl-D
c. exit
d. :wq

A

B.

The Ctrl-D key sequence sends the end-of-file (EOF) character to the at shell and closes it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which command enables you to see current at jobs scheduled for execution?

a. atrm
b. atls
c. atq
d. at

A

C.

The atq command queries the at service and provides an overview of jobs currently scheduled for execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly