Run anacron at 11:59 PM

I am trying to run may logrotator using following anacron setup to run it at 11:59 PM as daily task.

My current setting for /etc/anacrontab

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=0
# the jobs will be started during the following hours only
START_HOURS_RANGE=23-23

#period in days   delay in minutes   job-identifier   command
1       59      cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

but this is not working. May be reason is START_HOURS_RANGE=23-23 that is not valid range. Is there any way that I can set it up so that it will run every day at exactly 11:59 PM? (if server running)

Last anacron daily running time is (var/spool/anacron/cron.daily ) 20180322

my cron log

run-parts(/etc/cron.hourly)[31456]: starting 0anacron
Mar 27 11:01:01 ********[31467]: Anacron started on 2018-03-27
Mar 27 11:01:01 ******** anacron[31467]: Normal exit (0 jobs run)

Any kind of help is appreciable. Thanks

0
задан 27 March 2018 в 08:35
1 ответ

Ваше требование, чтобы это задание запускалось каждый день ровно в 23:59, если сервер работает , настоятельно указывает на то, что вы используете Anarcon для чего-то, что вы должны использовать Cron вместо. Anacron предназначен для ежедневного выполнения заданий независимо от часов, в которые работает машина, в то время как ваша цель - выполнять их в фиксированную минуту. Для этого достаточно простого задания cron:

59   23   *    *    *    command
1
ответ дан 4 December 2019 в 16:00

Теги

Похожие вопросы