make the sleep time/min on/max off numbers settable via options, and
notate this appropriately.
This commit is contained in:
parent
17a22f18ea
commit
bb1d2dd636
@ -24,7 +24,7 @@
|
||||
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: accountant.8,v 1.3 1993/05/03 03:06:32 cgd Exp $
|
||||
.\" $Id: accountant.8,v 1.4 1993/05/03 04:08:16 cgd Exp $
|
||||
.\"
|
||||
.Dd May 2, 1993
|
||||
.Dt ACCOUNTANT 8
|
||||
@ -34,10 +34,14 @@
|
||||
.Nd copy accounting records to the accounting log
|
||||
.Sh SYNOPSIS
|
||||
.Nm accountant
|
||||
.Op Fl V
|
||||
.Op Fl d
|
||||
.Op Fl s
|
||||
.Op Fl f Ar log file
|
||||
.Op Fl F Ar accounting device
|
||||
.Op Fl m Ar min on
|
||||
.Op Fl M Ar max off
|
||||
.Op Fl t Ar sleep time
|
||||
.Sh DESCRIPTION
|
||||
.Nm Accountant
|
||||
copies the accounting records generated by the
|
||||
@ -47,9 +51,18 @@ If invoked with no arguments,
|
||||
.Nm accountant
|
||||
becomes a daemon process and does its work silently.
|
||||
.Pp
|
||||
Recording of accounting information is automatically suspended
|
||||
if there is less than a given amount of free space left on the disk.
|
||||
Recording is automatically resumed when enough space becomes available.
|
||||
.Pp
|
||||
Options:
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl V
|
||||
Print program version information and exit.
|
||||
.El
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl d
|
||||
Run in debug mode. Do not become a
|
||||
daemon process, and write useful information
|
||||
@ -76,6 +89,38 @@ Read accounting records from
|
||||
rather than the default
|
||||
accounting device.
|
||||
.El
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl m Ar min on
|
||||
Suspend accounting when there is less than
|
||||
.Ar min on
|
||||
percent free space left on the disk.
|
||||
By default,
|
||||
.Ar min on
|
||||
is two percent.
|
||||
.El
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl M Ar max off
|
||||
Resume accounting when there is more than
|
||||
.Ar max off
|
||||
percent free space left on the disk.
|
||||
By default,
|
||||
.Ar max off
|
||||
is four percent.
|
||||
.El
|
||||
.Pp
|
||||
.Bl -tag -width Fl
|
||||
.It Fl t Ar sleep time
|
||||
Check to see whether there is enough
|
||||
disk space to resume accounting every
|
||||
.Ar sleep time
|
||||
seeconds, when accounting has been suspended
|
||||
because of a disk space shortage.
|
||||
By default,
|
||||
.Ar sleep time
|
||||
is 15 seconds.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/account/acct -compact
|
||||
.It Pa /var/account/acct
|
||||
|
@ -25,9 +25,7 @@
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LINT
|
||||
static char *rcsid = "$Id: accountant.c,v 1.2 1993/05/03 03:06:33 cgd Exp $";
|
||||
#endif
|
||||
static char *rcsid = "$Id: accountant.c,v 1.3 1993/05/03 04:08:17 cgd Exp $";
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
@ -52,10 +50,11 @@ int debug;
|
||||
#define dprintf if (debug) printf
|
||||
#define dperror if (debug) perror
|
||||
|
||||
void usage(char *progname)
|
||||
void usage(void)
|
||||
{
|
||||
printf("usage: %s [-d] [-f accounting log] [-F accounting device]\n",
|
||||
progname);
|
||||
fprintf(stderr, "usage: accountant [-V] [-d] [-s] [-f accounting log] [-F accounting device]\n");
|
||||
fprintf(stderr, " [-m min_on pct] [-M max_off pct] [-t sleep time]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void reinitfiles(int num)
|
||||
@ -113,8 +112,12 @@ main(argc, argv)
|
||||
extern int optind;
|
||||
FILE *pidf;
|
||||
|
||||
while ((ch = getopt(argc, argv, "df:F:")) != EOF) {
|
||||
while ((ch = getopt(argc, argv, "Vdsf:F:m:M:t:?")) != EOF) {
|
||||
switch ((char) ch) {
|
||||
case 'V': /* version */
|
||||
fprintf(stderr, "version: %s\n", rcsid);
|
||||
exit(0);
|
||||
break;
|
||||
case 'd': /* debug it */
|
||||
debug = 1;
|
||||
break;
|
||||
@ -127,14 +130,29 @@ main(argc, argv)
|
||||
case 'F': /* set device */
|
||||
acctdev = optarg;
|
||||
break;
|
||||
case 'm': /* set min free */
|
||||
min_on = atoi(optarg);
|
||||
if (min_on < 0 || min_on > 100)
|
||||
usage();
|
||||
break;
|
||||
case 'M': /* set max free */
|
||||
max_off = atoi(optarg);
|
||||
if (max_off < 0 || max_off > 100)
|
||||
usage();
|
||||
break;
|
||||
case 't': /* set sleep time */
|
||||
sleeptime = atoi(optarg);
|
||||
if (sleeptime < 1)
|
||||
usage();
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage(argv[0]);
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc -= optind)
|
||||
usage(argv[0]);
|
||||
usage();
|
||||
|
||||
openlog("accountant", LOG_PERROR, LOG_DAEMON);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user