cleaner.sh
is a script to keep a finite number of backup (files) matching a
pattern. It should be scheduled on a regular basis from the outside, e.g. with
cron
.
cleaner.sh
takes a number of single or double-dashed options, possibly
followed by a command to execute once the removal operations have ended. It is
preferrable to separate the list of options from the command using a
double-dash, to mark the definitive end of the options.
The following options are recognised.
The value of this option should be the number of files to keep. It defaults to an empty string, which is understood as keeping all the files.
The value of this option is (usually) a glob-style pattern to point at the list of files to select from when removing the oldest ones.
When this option is given, verbosity will be increased.
This utility is tuned for maximal compatibility. It only requires a basic POSIX
shell. As a result, cleaner.sh
can easilty be used from containers or in
embedded systems.