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
Q

Where can I find information on the cron tab fileds?

A

/etc/crontab

26
Q

Where do I get help on system cron tabs?

A

man 5 crontab

27
Q

What is the cron drop in directory

A

/etc/cron.d

28
Q

Explain run‐parts command

A

command used to run all the executable scripts or programs in a directory in alphabetical order.

29
Q

Anacron

A

scheduling tasks to be executed periodicallyin systems not always on. Or when you do not care about precise executime time (daily, weekly, hourly).

30
Q

What are the anacron drop in directory

A

1) /etc/cron.hourly/,
2) /etc/cron.weekly/,
3) /etc/cron.daily/
4) /etc/cron.monthy/

31
Q

what is anacrontab?

A

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
Q

Explain nice command

A

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
Q

Setup anacron job to update locate database every hour

A
echo 'updatedb' > /etc/cron.hourly/locate
34
Q

List all systemd timer units

A
systemctl list-units --type timer
35
Q

Explain: w -h

A

w with no header

36
Q

How do you reload systemd after changing some units?

A
systemctl daemon-reload
37
Q

Enable a timer unit that was recently installed

A

systemctl enable –now sysstat-collect.timer

38
Q

Explain:

crontab filename
A

Replace all jobs with those read from filename. This command uses stdin input when no file is specified.

39
Q

How do you set who should receive the output of cron job execution?

A

Set MAILTO var in crontab file

40
Q

You want crond to run a command that requires data via stdin. How do you set it up?

A

Separate the command (inc its arguments) with the stdin data with percent sign

41
Q

A cron job writes to stdout. What happens with this output?

A

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
Q

Instruct you shell to sleep until a file is created

A
while ! test -f filename.txt; do sleep 1s; done
43
Q

remove all cron jobs

A

crontab -r

44
Q

What do you put in following folders?

/etc/cron.daily/
/etc/cron.weekly/
/etc/cron.monthly/
A

bash files with execute permission

45
Q

What are the fields of an anacron tab entry?

A

1) perdiod in days (1: for daily, 7 for weekly, @monthly)
2) period in minutes
3) job id
4) command

46
Q

Explain “Delay in minutes” in anacrontab

A

the time that the crond daemon must wait before it starts the job.

47
Q

Parameters that determine when anacron job will be run

A

1) RANDOM_DELAY
2) START_HOURS_RANGE
3) Delay in minutes

48
Q

Install sysstat package

A

dnf install sysstat

49
Q

What is sysstat

A

A unit that collects system stats regularly (by default 10 min)