-1

I need to logrotate on system boot. I created a custom config for logrotate to zip the file. The solution with @reboot does not work.

In root crontable I have something like this:

@reboot --force /etc/logrotate.conf

but it doesn't work. I am working on Debian 10.

TomKo1
  • 214
  • 2
  • 14

1 Answers1

0

I'm going to assume you mean crontab when you say 'crontable', in which case your formatting is just incorrect. Per the crontab man page (1) :

These special time specification "nicknames" are supported, 
which replace the 5 initial time and date fields, and are prefixed by the '@' character:

@reboot    :    Run once after reboot.

The @reboot nickname only replaces the 5 time/date fields; you still need to follow the rules on how commands are formatted in crontab (again, from the manpages):

<date fields> <user to run command as> <command to run>

E.g.,

30 12 * 8 * root touch /tmp/file

So if you want to use the @reboot nickname, all you should be replacing are the five time/date fields at the beginning of the string, e.g.

@reboot root touch /tmp/file

parttimeturtle
  • 1,125
  • 7
  • 22