1、重建hash表:postmap hash:/etc/mail/access
==>自动建立 /etc/mail/access.db
注:sendmail的rpm包中,也有一个makemap命令,也支持重新生成hash表:
makemap hash /etc/mail/access.db < /etc/mail/access
2、查询某个表:postmap -q milter-limit-to-Sum:a@a.com /etc/mail/access
=>-q参数后面跟的是key,自动查/etc/mail/access.db文件中key=milter-limit-to-Sum:a@a.com的
记录举例:
# postmap -q milter-limit-to-Sum:a@a.com /etc/mail/access
1/1h man postmap中-q参数的说明:
-q key Search the specified maps for key and write the first value found to the standard output stream. The exit status is zero when the requested
information was found.
If a key value of - is specified, the program reads key values from the standard input stream and writes one line of key value output for each
key that was found. The exit status is zero when at least one of the requested keys was found.
3、删除某个键:postmap -d milter-limit-to-Sum:a@a.com /etc/mail/access
=>-d参数后面跟的是key,删除/etc/mail/access.db文件中key=milter-limit-to-Sum:a@a.com的记录
举例:
# postmap -q milter-limit-to-Sum:a@a.com /etc/mail/access
1/1h
# postmap -d milter-limit-to-Sum:a@a.com /etc/mail/access
# postmap -q milter-limit-to-Sum:a@a.com /etc/mail/access
# man postmap中-d参数的说明:
-d key Search the specified maps for key and remove one entry per map. The exit status is zero when the requested information was found.
If a key value of - is specified, the program reads key values from the standard input stream. The exit status is zero when at least one of the
requested keys was found.
4、增加一个键值:echo "milter-limit-to-Sum:a@a.com 1/1h" | postmap -i /etc/mail/access
=>增加"milter-limit-to-Sum:a@a.com 1/1h"键值至/etc/mail/access.db
举例:
# echo "milter-limit-to-Sum:a@a.com 1/1h" | postmap -i /etc/mail/access
# postmap -q milter-limit-to-Sum:a@a.com /etc/mail/access
1/1h man postmap中-i参数的说明:
-i Incremental mode. Read entries from standard input and do not truncate an existing database. By default, postmap(1) creates a new database from
the entries in file_name.