LFCS Exam QuestionsBrowse all questions from this exam

LFCS Exam - Question 127


Which of the following crontab entries will execute myscript at 30 minutes past every hour on Sundays?

Show Answer
Correct Answer: D

To execute 'myscript' at 30 minutes past every hour on Sundays, the correct crontab entry must specify the minute as 30, the hour as any hour, and the day of the week as 0 (Sunday). The format for this in a crontab is 'minute hour day_of_month month day_of_week command'. Option D '30 0-23 * * 0 myscript' correctly specifies to run the script at 30 minutes past every hour (0-23) on Sundays (0).

Discussion

3 comments
Sign in to comment
rona962Option: B
Apr 18, 2023

The correct answer is: B. 30 * * * 6 myscript. Explanation: In a crontab entry, there are five fields that specify when the command should be executed: The first field specifies the minutes (0-59). The second field specifies the hours (0-23). The third field specifies the day of the month (1-31). The fourth field specifies the month (1-12). The fifth field specifies the day of the week (0-6), where 0 is Sunday. In the crontab entry "30 * * * 6 myscript", the "30" in the first field specifies that the command should be run at 30 minutes past the hour, the "*" in the second, third and fourth fields means "any hour", "any day of the month" and "any month", respectively. The "6" in the fifth field specifies that the command should be run on Sundays. Therefore, this crontab entry will execute "myscript" at 30 minutes past every hour on Sundays.

EliteAllenOption: B
Dec 21, 2023

minute hour day_of_month month day_of_week command B. 30 * * * 6 myscript: This is correct regarding the day of the week (6 represents Saturday in the crontab, where Sunday is 0), but it will run every hour on Saturdays, not Sundays.

ncsikiOption: D
Jan 2, 2024

Answer is D https://crontab.guru/#30_0-23_*_*_0