nerdexam
CompTIA

XK0-004 · Question #309

Joe, a user, asks a systems administrator to schedule the daily execution of a custom script. Which of the following commands will allow the systems administrator to set up Joe's cron job?

The correct answer is B. crontab -e -u joe. The crontab -e -u flag combination opens the cron schedule in edit mode for a specified user, allowing an administrator to create or modify that user's scheduled jobs.

System Management

Question

Joe, a user, asks a systems administrator to schedule the daily execution of a custom script. Which of the following commands will allow the systems administrator to set up Joe’s cron job?

Options

  • Acrontab -r -u joe
  • Bcrontab -e -u joe
  • Ccrontab -n -u joe
  • Dcrontab -l -u joe

How the community answered

(26 responses)
  • A
    8% (2)
  • B
    88% (23)
  • D
    4% (1)

Why each option

The crontab -e -u flag combination opens the cron schedule in edit mode for a specified user, allowing an administrator to create or modify that user's scheduled jobs.

Acrontab -r -u joe

The crontab -r flag removes (deletes) the user's entire crontab, which destroys all existing scheduled jobs rather than creating new ones.

Bcrontab -e -u joeCorrect

The crontab -e flag opens the target user's crontab file in a text editor for modification, and -u joe specifies that the operation applies to joe's crontab. This combination allows a systems administrator to schedule a daily cron job on behalf of another user without logging in as that user.

Ccrontab -n -u joe

The -n flag is not a valid standard crontab option and will produce an error on most Linux distributions.

Dcrontab -l -u joe

The crontab -l flag only lists (displays) the current crontab entries for a user but does not open an editor or allow any modifications.

Concept tested: Scheduling cron jobs for another user with crontab

Source: https://man7.org/linux/man-pages/man1/crontab.1.html

Topics

#cron#crontab#job scheduling#task automation

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice