COHERENT manpages

This page displays the COHERENT manpage for savelog [Save a mail log].

List of available manpages
Index


savelog -- Command

Save a mail log
/usr/lib/mail/savelog [-c cycle] [-g group] [-l]
                [-m mode] [-u user] [-t] file ...

The script savelog archives each file. This script normally is used to save
copies of smail's log files, and of other files that grow relentlessly.  It
copies each file  into a special archiving directory, and  gives the copy a
name  that  reflects  how recently  it  was  created.   Unless you  request
otherwise, it also compresses each file.

When it  saves file, savelog copies it into  directory $PWD/OLD, where $PWD
represents the  directory within which the file  normally resides.  If sub-
directory OLD does not exist, savelog creates it, and gives it mode 0755.

As you probably  will invoke savelog periodically to save  a log file, this
directory can  hold an indefinite number of archives  of file, each created
at  a different  time in  the past.   To help  you distinguish  among these
archives, savelog names them as follows:

    file.number[.compression_suffix]

number represents the order in  which the archives were created, zero being
the  newest;   and  compression_suffix   indicates  the  suffix   that  the
compression program gives the file --  .Z if the archive is compressed with
compress (which  savelog uses by default), or .gz  if compressed with gzip.
Note that archive `0' is never compressed, on the off chance that a process
still has its corresponding file opened for input.

If file  does not  exist or  has zero length,  savelog performs  no further
processing.  To override this behavior, use option -t.

When file exists  and has a length greater than  zero, savelog performs the
following actions:

-> First, it increases  by one the version number of  each existing copy of
   file. For example, if you are saving file foo for the seventh time, then
   savelog moves file foo.6 to foo.7; then moves foo.5 to foo.6; and so on.
   savelog does  this regardless  of whether  an archive is  compressed, or
   whether you  used option  -t on the  command line.  By  default, savelog
   keeps  only  seven versions  of  a  given file,  and  throws away  those
   versions that  exceed that limit.   To increase or  decrease this limit,
   use command-line option -c, described below.

-> If you  did not use command-line option -t,  savelog next compresses the
   new  file.1.  It  also changes  this file,  subject to  the command-line
   options -m, -u, and -g (described below).

-> It moves file to OLD/file.0.

-> If you  use any of the  command-line options -m, -u,  -g, or -t, savelog
   re-creates file, subject to the given flags.

-> Finally, savelog modifies  the newly created file OLD/file.0, subject to
   the settings of command-line options -m, -u, and -g.

Command-line Options

savelog recognizes the following command-line options:

-c cycle
     Save  no more  than cycle  versions  of  file.  The default  is seven,
     numbered `0' through `6'.  cycle must  be no less than two.  Note that
     because numbering  begins with zero,  version number cycle  of file is
     never created.

-g group
     Use the  command chgrp to give  group the group ownership  of file and
     its archives.

-l   Do not compress any log files.

-m mode
     Invoke the command chmod to set permissions on the log files to mode.

-t   Touch file-- that is, create a new, empty copy of file after archiving
     it.  This lets you ensure that the log file is re-created with correct
     permissions.

-u user
     Invoke the  command chown to  make user the  owner of the  archives of
     file.

See Also

commands,
mail [overview],
uulog

Notes

If you  do not use any  of the command-line options -m,  -u, or -g, savelog
does not re-create file after archiving it.

Copyright © 1987, 1988 Ronald S. Karr and Landon Curt Noll.  Copyright
© 1992 Ronald S. Karr.

For  details on  the distribution rights  and restrictions  associated with
this software, see file COPYING, which  is included with the source code to
the smail system; or type the command: smail -bc.