rotate
This script rotates files and directories, about the same way as logrotate does. The main difference is that rotate is a shell script for Bash. Because of this, it does depend on a few applications (chmod, chown, date, mkdir, mv, rm, stat, tar, and optionally bzip2 en gzip), but it's also a lot smaller, probably making it more suitable for systems that are low on disk space. Also, rotate is a bit simpler in use, because it doesn't need extensive configuration files. Result of this is that rotate has less options; e.g. it doesn't stop and start services.
rotate was tested with Bash 4.0.10 on FreeBSD and Bash 3.2.19 on Mandriva Linux, but it should work with all recent Bash versions on all systems that have the aforementioned apps installed.
The rotate code can be viewed at svn.Nerdstock.org; the script can be downloaded from download.Nerdstock.org.
rob@laptop> rotate -h Usage: rotate -f <file> [-k <number>] [-q] [-s <size>] [-t <age>] [-z <method>] -f filename (may also be a directory) -k number of files to keep (defaults to 10) -q quiet -s maximum file size in bytes (optionally append k for KB, m for MB, g for GB or t for TB) -t maximum file age in hours (optionally append d for days, w for weeks, m for months or y for years) -z compression method (may be one of bzip2 or gzip) The -f flag may be specified multiple times for multiple files/directories. If the other flags are specified multiple times, the last specified value is used. rotate -h displays this message.
| Responses are welcomed: rob[at]nerdstock.org |
|







