Add an /etc/crontab entry to run /usr/local/sbin/backup as user backup every day at 03:15.
Which entry is appropriate?
System crontab files have five time fields, then the execution user, then the command. User crontabs omit the user field.
Detailed explanation
15 3 * * * /usr/local/sbin/backup backupIncorrect. It puts the user after the command.
Incorrect. It puts the user after the command.
15 3 * * * backup /usr/local/sbin/backupCorrect. It places backup after the five time fields and before the command.
Correct. It places backup after the five time fields and before the command.
15 3 * * backup /usr/local/sbin/backupIncorrect. One time field is missing, so backup is misread as a schedule value.
Incorrect. One time field is missing, so backup is misread as a schedule value.
backup 15 3 * * * /usr/local/sbin/backupIncorrect. The user is not placed before the time fields.
Incorrect. The user is not placed before the time fields.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '15 3 * * * backup /usr/local/sbin/backup' | awk '{print $6, $7}'Expected result
backup /usr/local/sbin/backupKey points
- System crontab has a user field
- The sixth field is the user
- Different from user crontab
Notes
- Environment: POSIX awk / 模擬エントリのみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.