diff options
author | Jan Kara <jack@suse.cz> | 2012-01-31 00:24:51 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-01-31 00:24:51 +0100 |
commit | a5cae9e2fb3495b623a0ee5e6a92294d40b54650 (patch) | |
tree | c820419cfa25353235f720f91d72a26f0a1011c5 | |
parent | 40e09a3b49827699d770f8144f973d4928f248b2 (diff) | |
download | linuxquota-a5cae9e2fb3495b623a0ee5e6a92294d40b54650.tar.gz |
warnoquota: Allow specifying of filesystems to check
Allow user to specify filesystems to check with warnquota on command line.
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | warnquota.8 | 8 | ||||
-rw-r--r-- | warnquota.c | 10 | ||||
-rw-r--r-- | warnquota.conf | 3 |
3 files changed, 12 insertions, 9 deletions
diff --git a/warnquota.8 b/warnquota.8 index 0d85f96..9182d5c 100644 --- a/warnquota.8 +++ b/warnquota.8 @@ -17,12 +17,14 @@ warnquota \- send mail to users over quota ] [ .B \-a .I adminsfile +] [ +.I filesystem... ] .SH DESCRIPTION .B warnquota -checks the disk quota for each local filesystem and mails a warning -message to those users who have reached their softlimit. -It is typically run via +checks the disk quota for specified local filesystems (or for each local +filesystem if none specified) and mails a warning message to those users who +have reached their softlimit. It is typically run via .BR cron (8). .TP .B -F, --format=\f2quotaformat\f1 diff --git a/warnquota.c b/warnquota.c index 2ca286f..3b81909 100644 --- a/warnquota.c +++ b/warnquota.c @@ -939,7 +939,7 @@ static struct quota_handle *find_handle_dev(char *dev, struct quota_handle **han return handles[i]; } -static void warn_quota(void) +static void warn_quota(int fs_count, char **fs) { struct quota_handle **handles; struct configparams config; @@ -951,7 +951,7 @@ static void warn_quota(void) wc_exit(1); if (flags & FL_USER) { - handles = create_handle_list(0, NULL, USRQUOTA, -1, IOI_READONLY | IOI_INITSCAN, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(fs_count, fs, USRQUOTA, -1, IOI_READONLY | IOI_INITSCAN, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); if (!maildev[0] || !strcasecmp(maildev, "any")) maildev_handle = NULL; else @@ -963,7 +963,7 @@ static void warn_quota(void) if (flags & FL_GROUP) { if (get_groupadmins() < 0) wc_exit(1); - handles = create_handle_list(0, NULL, GRPQUOTA, -1, IOI_READONLY | IOI_INITSCAN, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(fs_count, fs, GRPQUOTA, -1, IOI_READONLY | IOI_INITSCAN, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); if (!maildev[0] || !strcasecmp(maildev, "any")) maildev_handle = NULL; else @@ -979,7 +979,7 @@ static void warn_quota(void) /* Print usage information */ static void usage(void) { - errstr(_("Usage:\n warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile]\n\n\ + errstr(_("Usage:\n warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...]\n\n\ -u, --user warn users\n\ -g, --group warn groups\n\ -s, --human-readable send information in more human friendly units\n\ @@ -1073,7 +1073,7 @@ int main(int argc, char **argv) parse_options(argc, argv); init_kernel_interface(); - warn_quota(); + warn_quota(argc - optind, argc > optind ? argv + optind : NULL); wc_exit(0); return 0; diff --git a/warnquota.conf b/warnquota.conf index 8801a88..2a72b78 100644 --- a/warnquota.conf +++ b/warnquota.conf @@ -4,7 +4,8 @@ # and even blank lines # values can be quoted: -MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t" +#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t" +MAIL_CMD = "/bin/echo" FROM = "bas@example.com" # but they don't have to be: SUBJECT = Hey, user, clean up your account! |