Hello every body 
I have a mail server to admin, with postfix and quota, all mails are stored in /home/user/.mailbox.
I want to write a shell script that start evry 00H01 so it will verify the quota of users, and if user have mailbox size great than the soft quota limit, this script will send warning email to that user.
But how to interact between awk and system command (mail)?
I do in shell #repquota -a | Myscript.sh
So here is the (ugly ) small script i write:
############################################################
#!/bin/gawk -f
{
if ($2 == "--"
{
print "for user "$1" : all is well
"
echo -e "\a"
}else if ($2 == "+-" ){
print " for user "$1" : WRNING here !!!!"
}
}
############################################################
I have redhat 8.0 with compiled kernel 2.4.20 with quota enabled here is the output:
############################################################
[root@haneo /]# repquota -a
*** Report for user quotas on device /dev/hda7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
------------------------------------------------------------
root -- 1 0 0 2 0 0
haneo +- 109 100 200 7days 10 0 0
############################################################
Thanks for all !
I have a mail server to admin, with postfix and quota, all mails are stored in /home/user/.mailbox.
I want to write a shell script that start evry 00H01 so it will verify the quota of users, and if user have mailbox size great than the soft quota limit, this script will send warning email to that user.
But how to interact between awk and system command (mail)?
I do in shell #repquota -a | Myscript.sh
So here is the (ugly ) small script i write:
############################################################
#!/bin/gawk -f
{
if ($2 == "--"
print "for user "$1" : all is well
echo -e "\a"
}else if ($2 == "+-" ){
print " for user "$1" : WRNING here !!!!"
}
}
############################################################
I have redhat 8.0 with compiled kernel 2.4.20 with quota enabled here is the output:
############################################################
[root@haneo /]# repquota -a
*** Report for user quotas on device /dev/hda7
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
------------------------------------------------------------
root -- 1 0 0 2 0 0
haneo +- 109 100 200 7days 10 0 0
############################################################
Thanks for all !