Score:0

How to edit daily crontab

tt flag

What is the line, or lines, you would add to your crontab file to run the script /etc/cron.daily/logrotate every 3 hours on Friday, Saturday, and Sunday but only once per day at midnight on the other days of the week? What would be the command for this?

Score:0
it flag
0 0 * * 1-4 /etc/cron.daily/logrotate
0 */3 * * 5-7 /etc/cron.daily/logrotate

These lines will run the /etc/cron.daily/logrotate script every day at midnight from Monday to Thursday and on Saturday. On Fridays, Saturdays, and Sundays, the script will be run every three hours using the */3 syntax.

Note that the first line uses the syntax 1-4 to specify the days of the week when the script should be run at midnight. This means Monday to Thursday (1-4).

You can check crontab guru to help you with cron questions, also.

Gabriel Ozzy avatar
it flag
@RomeoNinov You're right. Fixed it now =]
momi bhatti avatar
tt flag
Hey Gabriel Ozzy! Thank you It worked. I have added this command to my assignment.
Gabriel Ozzy avatar
it flag
Glad to hear and happy to help
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.