glpi 与 ldap 自动同步
先在glpi的设置里面
【查找ldap_mass_sync.php脚本文件的位置】
[root@hghast001 etc]# find / -iname *ldap_mass_sync.php* /var/www/html/glpi/scripts/ldap_mass_sync.php
【查看ldap_mass_sync.php 脚本的使用说明】
[root@nb0001 ~]# php /var/www/html/glpi1/scripts/ldap_mass_sync.php --help Usage: php -q -f ldap_mass_sync.php [action=<option>] [ldapservers_id=ID] Options values: 0: import users only 1: synchronize existing users only 2: import & synchronize users before-days: restrict user import or synchronization to the last x days after-days: restrict user import or synchronization until the last x days ldap_filter: ldap filter to use for the search. Value must be surrounded by ""
【ldap_mass_sync.php 添加用户】
[root@nb0001 ~]# php -q -f /var/www/html/glpi1/scripts/ldap_mass_sync.php action=0 Processing LDAP Server: glpi, ID: 1 ................................... Imported: 35 Synchronized: 0 Deleted from LDAP: 0
【添加并同步】,会disabled离职人员的姓名
[root@nb0001 ~]# php -q -f /var/www/html/glpi1/scripts/ldap_mass_sync.php action=2 Processing LDAP Server: glpi, ID: 1 ............................................................... Imported: 0 Synchronized: 236 Deleted from LDAP: 34
【每小时自动同步】
[root@hghast001 etc]# vim /etc/crontab 1 * * * * /usr/bin/php -q -f /usr/bin/php -q -f /var/www/html/glpi/scripts/ldap_mass_sync.php action=2 >> /dev/null 2>&1
【完成】
本文出自 “生命不息,折腾不止。” 博客,谢绝转载!
原文地址:http://990487026.blog.51cto.com/10133282/1693898