summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog4
-rw-r--r--Makefile.in4
-rw-r--r--quotaon.c9
-rw-r--r--warnquota.843
-rw-r--r--warnquota.c47
5 files changed, 97 insertions, 10 deletions
diff --git a/Changelog b/Changelog
index 9d7b184..583996d 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,10 @@
Changes in quota-tools from 3.03 to 3.04
* added -D_FILE_OFFSET_BITS=64 to Makefile - fixes problems with large files with some libcs (Michael Meskes)
* added -p (print state) to quotaon (Vladimir Linek, Jan Kara)
+* made quotaon(8) write better error messages (Jan Kara)
+* make install now creates man directories (Jan Kara)
+* added -q <quotatab> and -c <configfile> options to warnquota(8) (Jan Kara)
+* added some notes about quotatab to warnquota manpage (Jan Kara)
Changes in quota-tools from 3.02 to 3.03
diff --git a/Makefile.in b/Makefile.in
index 80a7bf0..33d16cf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -80,6 +80,10 @@ install: all inst_mo
-$(INSTALL) -m $(DEF_SBIN_MODE) \
edquota repquota warnquota quotastats setquota quot xqmstats \
$(ROOTDIR)$(sbindir)
+ -mkdir -p $(ROOTDIR)$(mandir)/man1
+ -mkdir -p $(ROOTDIR)$(mandir)/man2
+ -mkdir -p $(ROOTDIR)$(mandir)/man3
+ -mkdir -p $(ROOTDIR)$(mandir)/man8
-$(INSTALL) -m 755 -d $(ROOTDIR)$(includedir)/rpcsvc
-$(INSTALL) -m 644 rquota.h rquota.x $(ROOTDIR)$(includedir)/rpcsvc
-$(INSTALL) -s -m $(DEF_SBIN_MODE) quota $(ROOTDIR)$(bindir)
diff --git a/quotaon.c b/quotaon.c
index b749037..03d0149 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaon.c,v 1.11 2002/02/22 13:54:54 jkar8572 Exp $"
+#ident "$Id: quotaon.c,v 1.12 2002/02/22 14:58:32 jkar8572 Exp $"
/*
* Turn quota on/off for a filesystem.
@@ -220,7 +220,12 @@ static int quotaonoff(char *quotadev, char *quotadir, char *quotafile, int type,
}
qcmd = QCMD(Q_QUOTAON, type);
if (quotactl(qcmd, quotadev, 0, (void *)quotafile) < 0) {
- errstr(_("using %s on %s [%s]: %s\n"), quotafile, quotadev, quotadir, strerror(errno));
+ if (errno == ENOENT)
+ errstr(_("can't find %s on %s [%s]\n"), quotafile, quotadev, quotadir);
+ else
+ errstr(_("using %s on %s [%s]: %s\n"), quotafile, quotadev, quotadir, strerror(errno));
+ if (errno == EINVAL)
+ errstr(_("Maybe create new quota files with quotacheck(8)?\n"));
return 1;
}
if (flags & STATEFLAG_VERBOSE)
diff --git a/warnquota.8 b/warnquota.8
index 9acd434..f89a0ea 100644
--- a/warnquota.8
+++ b/warnquota.8
@@ -3,12 +3,48 @@
warnquota \- send mail to users over quota
.SH SYNOPSIS
.B warnquota
+[
+.B \-F
+.I quotaformat
+] [
+.B \-q
+.I quotatab
+] [
+.B \-c
+.I configfile
+]
.SH DESCRIPTION
.B warnquota
checks the disk quota for each filesystem and mails a warning
message to those users who have reached their limit.
It is typically run via
.BR cron (8).
+.TP
+.B -F \f2quotaformat\f1
+Perform setting for specified format (ie. don't perform format autodetection).
+Possible format names are:
+.B vfsold
+(version 1 quota),
+.B vfsv0
+(version 2 quota),
+.B rpc
+(quota over NFS),
+.B xfs
+(quota on XFS filesystem)
+.TP
+.B -q quotatab
+Use
+.I quotatab
+instead of
+.I /etc/quotatab
+as file with device description strings (see example file for syntax).
+.TP
+.B -c configfile
+Use
+.I configfile
+instead of
+.I /etc/warnquota.conf
+as configuration file (see example file for syntax).
.SH FILES
.PD 0
.TP 20
@@ -21,6 +57,9 @@ quota file at the filesystem root (version 1 quota, non-XFS filesystems)
.B /etc/warnquota.conf
configuration file
.TP
+.B /etc/quotatab
+device description
+.TP
.B /etc/mtab
default filesystems
.TP
@@ -33,5 +72,5 @@ default set of users
.BR edquota (8).
.SH AUTHORS
.BR warnquota (8)
-was written by Marco van Wieringen <mvw@planets.elm.net>.
-This reference page written by Heiko Schlittermann <heiko@lotte.sax.de>.
+was written by Marco van Wieringen <mvw@planets.elm.net>, modifications by Jan Kara <jack@suse.cz>.
+This reference page written by Heiko Schlittermann <heiko@lotte.sax.de>, modifications by Jan Kara <jack@suse.cz>
diff --git a/warnquota.c b/warnquota.c
index 5beda58..43e47a1 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -10,7 +10,7 @@
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
- * Version: $Id: warnquota.c,v 1.7 2001/11/09 20:03:35 jkar8572 Exp $
+ * Version: $Id: warnquota.c,v 1.8 2002/02/22 14:58:32 jkar8572 Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -89,7 +89,8 @@ typedef struct quotatable {
char *devdesc;
} quotatable_t;
-int qtab_i = 0;
+int qtab_i = 0, fmt = -1;
+char *configfile = WARNQUOTA_CONF, *quotatabfile = QUOTATAB;
char *progname;
quotatable_t *quotatable = (quotatable_t *) NULL;
@@ -298,9 +299,10 @@ int get_quotatable(void)
int line;
struct stat st;
- if (!(fp = fopen(QUOTATAB, "r"))) {
- errstr(_("Can't open %s: %s\n"), QUOTATAB, strerror(errno));
- return -1;
+ if (!(fp = fopen(quotatabfile, "r"))) {
+ errstr(_("Can't open %s: %s\nWill use device names.\n"), quotatabfile, strerror(errno));
+ qtab_i = 0;
+ return 0;
}
line = 0;
@@ -444,7 +446,7 @@ void warn_quota(void)
struct configparams config;
int i;
- if (readconfigfile(WARNQUOTA_CONF, &config) < 0)
+ if (readconfigfile(configfile, &config) < 0)
exit(1);
if (get_quotatable() < 0)
exit(1);
@@ -456,12 +458,45 @@ void warn_quota(void)
exit(1);
}
+/* Print usage information */
+static void usage(void)
+{
+ errstr(_("Usage:\n warnquota [-F quotaformat] [-c configfile] [-q quotatabfile]\n"));
+}
+
+static void parse_options(int argcnt, char **argstr)
+{
+ int ret;
+
+ while ((ret = getopt(argcnt, argstr, "VF:hc:q:"))) {
+ switch (ret) {
+ case '?':
+ case 'h':
+ usage();
+ case 'V':
+ version();
+ break;
+ case 'F':
+ if ((fmt = name2fmt(optarg)) == QF_ERROR)
+ exit(1);
+ break;
+ case 'c':
+ configfile = optarg;
+ break;
+ case 'q':
+ quotatabfile = optarg;
+ break;
+ }
+ }
+}
+
int main(int argc, char **argv)
{
gettexton();
progname = basename(argv[0]);
warn_new_kernel(-1);
+ parse_options(argc, argv);
warn_quota();
return 0;