Group Sys Logo


Shell script: newlog

In the November 1997 edition of Unix Review, my Daemons & Dragons column provides a shell script for rotating log files. The shell script is called newlog and is also provided in electronic form for the convenience of my readers.

The script is intended to be invoked by cron. It takes at least two arguments. The first argument is the directory where log files are kept. The second and succeeding arguments are the names of the log files themselves. Each file is moved to an archive directory ("OLD" in the logfile directory) and compressed. New log files are created, and syslog is tickled to force it to begin logging to the new files.

For more details, see my column in the November 1997 edition of Unix Review.


Download a copy of newlog.