Scheduling Flashcards

1
Q

atd vs crond

A

atd: onet ime jobs
crond: recurring jobs

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

Which commands to use to schedule jobs

A

one off: at
recurring: crontab

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

Determine which jobs are schedule for one time execute

A

atq

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

remove an at job

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

Can’t open /run/atd.pid to signal atd. No atd running?

A

Install atd

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

Schedule an AT job for 5 min from now

A

at now +5min

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

teatime

A

4pm

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

Execute command at teatime and put the job in a queue called g

A
at -q g teatime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Cat an at job to the console

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

In order, list the fields of a cron job

A

minute
hour
day of month
month
day of week
command

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

In cron, what are values for day of the week?

A

0, 7 for Sunday
1 for Monday

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

true command

A

do nothing and return success code 0

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

false command

A

do nothing and return success code of 1

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

List the cron tabs

A

crontab -l

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

Install cron

A
dnf install cronie
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Create a cron job

A

crontab -e

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

source fancy dot command

A
. ~/.bashrc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Explain the crontab:

15,45  08,11,14   *  *  1-5  /bin/true
A

At 15 min or 45 min after 08, 11 or 1pm, any day of the month and for every month for working days, run /bin/true

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

Explain the cron tab:

*/10 * * *  * /bin/true
A

Every tenth instance of every hour, every day of month, every month, every day of the week

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

List the crontabs of student user

A

crontab -l -u student

21
Q

Where are cront tab installed

A

/var/spool/cron

22
Q

remove the crontab for student user

A
crontab -r -u student
23
Q

How many fields are used for user cron tabs?

A

6: min, hour, day of month, month, day of week command

24
Q

How many fields are used for system cron tabs?

A

7
additional field for the suer that the job is going to be executed as

25
Where can I find information on the cron tab fileds?
/etc/crontab
26
Where do I get help on system cron tabs?
man 5 crontab
27
What is the cron drop in directory
/etc/cron.d
28
Explain run‐parts command
command used to run all the executable scripts or programs in a directory in alphabetical order.
29
Anacron
scheduling tasks to be executed periodicallyin systems not always on. Or when you do not care about precise executime time (daily, weekly, hourly).
30
What are the anacron drop in directory
1) /etc/cron.hourly/, 2) /etc/cron.weekly/, 3) /etc/cron.daily/ 4) /etc/cron.monthy/
31
what is anacrontab?
The anacrontab file in Linux is a configuration file for the Anacron service. It specifies how often Anacron runs certain tasks, much like a crontab file for Cron
32
Explain nice command
nice is used to run a program with modified scheduling priority. By default, programs run with a normal priority level, but nice allows you to start a program with a lower priority, so that it uses less CPU resources.
33
Setup anacron job to update locate database every hour
```echo 'updatedb' > /etc/cron.hourly/locate```
34
List all systemd timer units
```systemctl list-units --type timer```
35
Explain: w -h
w with no header
36
How do you reload systemd after changing some units?
```systemctl daemon-reload```
37
Enable a timer unit that was recently installed
systemctl enable --now sysstat-collect.timer
38
Explain: ```crontab filename```
Replace all jobs with those read from filename. This command uses stdin input when no file is specified.
39
How do you set who should receive the output of cron job execution?
Set MAILTO var in crontab file
40
You want crond to run a command that requires data via stdin. How do you set it up?
Separate the command (inc its arguments) with the stdin data with percent sign
41
A cron job writes to stdout. What happens with this output?
if MAILTO is configured it is sent to the specified user. Otherwise if it is a system job, it is sent to root. And else, it is send to the job owner.
42
Instruct you shell to sleep until a file is created
```while ! test -f filename.txt; do sleep 1s; done```
43
remove all cron jobs
crontab -r
44
What do you put in following folders? ``` /etc/cron.daily/ /etc/cron.weekly/ /etc/cron.monthly/ ```
bash files with execute permission
45
What are the fields of an anacron tab entry?
1) perdiod in days (1: for daily, 7 for weekly, @monthly) 2) period in minutes 3) job id 4) command
46
Explain "Delay in minutes" in anacrontab
the time that the crond daemon must wait before it starts the job.
47
Parameters that determine when anacron job will be run
1) RANDOM_DELAY 2) START_HOURS_RANGE 3) Delay in minutes
48
Install sysstat package
dnf install sysstat
49
What is sysstat
A unit that collects system stats regularly (by default 10 min)