Forrest logo
back to the logrotate tool

logrotate:tldr:4471c

logrotate: Run without using a state (lock) file.
$ logrotate ${path-to-logrotate-conf} --state /dev/null
try on your machine

This command invokes the logrotate utility with the specified logrotate configuration file (${path-to-logrotate-conf}). The logrotate utility is responsible for managing and rotating log files to prevent them from becoming too large and consuming excessive disk space.

The "--state" option is used to specify the state file for logrotate. The state file keeps track of the last log files rotation timestamp. In this command, "/dev/null" is specified as the state file. "/dev/null" is a special device file in Unix-like systems that discards everything written to it without storing any data. By specifying "/dev/null" as the state file, logrotate will not retain any historical rotation information or timestamp records.

In summary, this command executes logrotate using a specified configuration file, and discards the state information (rotation timestamps) by directing it to "/dev/null".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the logrotate tool