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.
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)- A8% (2)
- B88% (23)
- D4% (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.
The crontab -r flag removes (deletes) the user's entire crontab, which destroys all existing scheduled jobs rather than creating new ones.
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.
The -n flag is not a valid standard crontab option and will produce an error on most Linux distributions.
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
Community Discussion
No community discussion yet for this question.