extmail全局通讯录默认是放在globabook.cf文件。通过脚本可以定时把extman后台添加的邮箱放到这个文件,已实现公司全局通讯录的要求。新建脚本:
vi /root/jobs/extmail_abook.sh chmod +x /root/jobs/extmail_abook.sh
脚本内容类似如下:
#!/bin/bash export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin mysql -h localhost -uextmail -p123456 mail -e "select name,username,domain from mailbox" > /tmp/abook.txt cat /tmp/abook.txt |sed 's/\t/","/g' |sed 's/^/"/g'|sed 's/$/"/g' > /var/www/extsuite/extmail/globabook.cf
添加计划任务
00 03 * * * /root/jobs/extmail_abook.sh >>/tmp/extmail_abook.log 2>&1