knowning how much time is left before cron weekly runs?

Solution 1:

The system crontab is usually defined in /etc/crontab/. It's here that the time interval for cron.weekly, cron.daily, etc is defined. My /etc/crontab/ looks like:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
 17 * *   *   *   root cd / && run-parts --report /etc/cron.hourly
 25 6 *   *   *   root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
 47 6 *   *   7   root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
 52 6 1   *   *   root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

So my cron.weekly will run at 6:47 on the 7th day of the week.

Edit: The above information only applies to scripts in the /etc/cron.weekly directory. As pointed out by Iain, @weekly is defined to run at midnight on Sunday.

Solution 2:

Yes, by doing this on the command line:

cat /etc/crontab

Somewhere in this file, you should see a line like this:

# m h dom mon dow user command

This describes the field order for each line below it. Otherwise, it's a whitespace-separated list, where each field goes in this order:

Minute, Hour, Day of Month, Month, Day of Week (where 0 or 7 is sunday and 6 is Saturday), Username to run command as, and Command to run.

There should be a line that ends in cron.weekly. This is your weekly run. By default this runs in the early hours of Sunday morning.

Also, try running this on the command line:

man crontab

Solution 3:

I believe that @weekly is equivalent to 0 0 * * 0 so it runs at midnight on Sunday.