Study Guide - Chap26: Automating Jobs Flashcards

(11 cards)

1
Q

2- What command do you use to disconnect a shell script from the current console so that it can continue to run after the console exits?

  • ˃
  • &
  • |
  • ˃˃
  • nohup
A

nohup

The nohup command disconnects the shell script from the current console session, so option E is correct. The greater‐than sign (˃) redirects the output from the command to a file, so option A is incorrect. The ampersand sign (&) runs the shell script in background mode, so option B is incorrect. The pipe symbol (|) redirects the output from the command to another command, so option C is incorrect. The double greater‐than symbol (˃˃) appends the output from the command to a file, so option D is incorrect.

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

nohup

A
  • A command that runs other programs immune to hangup signals (SIGHUP), allowing processes to continue running even after the user logs out or the terminal session ends.
  • Common usage includes nohup command & to run commands in the background that persist after logout, with output automatically redirected to nohup.out file.
  • Primary purpose ensures long-running tasks or scripts continue executing on remote systems even when SSH connections are terminated or users disconnect.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

4- How can you temporarily pause a shell script from running in foreground mode in a console session?

  • Press the Ctrl+Z key combination.
  • Press the Ctrl+C key combination.
  • Start the command with the nohup command.
  • Start the command with the ampersand (&) command.
  • Start the command with the fg command.
A

Press the Ctrl+Z key combination.

The Ctrl+Z key combination pauses the job currently running in foreground mode on the console session, so option A is correct. The Ctrl+C key combination stops the job currently running in the foreground in the console session, rather than pauses it, so option B is incorrect. The nohup command disconnects a job from the console session but doesn’t pause the job, so option C is incorrect. The ampersand sign (&) runs a job in background mode in the console session, so option D is incorrect. The fg command resumes a stopped job in foreground mode, so option E is incorrect.

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

5- How do you determine the default job running in a console session?

  • By the PID number
  • By the job number
  • By a plus sign next to the job number in the jobs output
  • By a minus sign next to the job number in the jobs output
  • By using the ps command
A

By a plus sign next to the job number in the jobs output

When you list the current jobs using the jobs command, there will be a plus sign next to the default job number, so option C is correct. The minus sign next to a job number indicates the job next in line to become the default job, so option D is incorrect. Neither the PID nor the job number indicates the default job, so options A and B are both incorrect. The ps command lists the running jobs but doesn’t indicate the default job in a console session, so option E is incorrect.

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

6- Barbara has an application running in background mode in her console session and needs to bring it to foreground mode. What command should she use to do that?

  • bg
  • fg
  • nohup
  • &
  • at
A

fg

The fg command allows you to change a currently running or stopped job to run in foreground mode on the current console session, so option B is correct. The bg command changes a currently running or stopped job to run in background mode, so option A is incorrect. The nohup command disconnects a job from the console session, so option C is incorrect. The ampersand sign (&) places a job in background mode, not foreground mode, so option D is incorrect. The at command runs a job in background mode at a specific time, so option E is incorrect.

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

bg

A

Resumes a suspended job in the background, allowing it to continue running while freeing up the terminal for other commands.

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

fg

A

Brings a background or suspended job to the foreground, making it the active process that receives keyboard input and displays output directly.

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

at

A

Schedules commands or scripts to run once at a specific time in the future, using syntax like at 3:30pm or at now + 2 hours for one-time job execution.

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

9- When will the cron table entry 10 5 * * * myscript run the specified shell script?

  • At 10:05 a.m. every day
  • On May 10th every year
  • On October 5th every year
  • At 5:10 p.m. every day
  • At 5:10 a.m. every day
A

At 5:10 a.m. every day

The times specified in the cron table are listed in the order of minute, hour, day of month, month, and day of week. The hour is in 24‐hour format, so the specified entry would run the job at 5:10 a.m. every day, making option E correct. Options A, B, C, and D are all incorrect times based on the specified entry.

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

cron format

A

five time fields plus the command:
minute hour day-of-month month day-of-week command

e.g.:
* Daily examples: 0 2 * * * /backup/script.sh runs at 2:00 AM daily, 30 23 * * * /cleanup.sh runs at 11:30 PM every night
* Weekly/Monthly examples: 0 9 * * 1 /weekly-report.sh runs Mondays at 9 AM, 0 0 1 * * /monthly-bill.sh runs first day of each month at midnight
* Interval examples: */15 * * * * /check-status.sh runs every 15 minutes, 0 */2 * * * /hourly-check.sh runs every 2 hours on the hour

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