# Groups we want to look for, in this case any group name that starts with HDP_
# Filter for users with a "valid" flag set who have a first name, last name and email.
# perform the search on AD and format the results in a way that postfix wants.
I have used your ambari-ldap sync script but I get the following error when I ran the below command. One thing I noticed is that if the run the script manually as ./ambari_ldap_sync_all.sh then its getting executed.
Also I have shown my ambari-ldap sync script below. So the script is not getting executed from crontab with 'sh' command . Please help.
[root@host1(172.23.34.4)] # sh ambari_ldap_sync_all.sh
ambari_ldap_sync_all.sh: line 3: spawn: command not found
couldn't read file "Enter Ambari Admin login:": no such file or directory
ambari_ldap_sync_all.sh: line 7: send: command not found
couldn't read file "Enter Ambari Admin password:": no such file or directory
ambari_ldap_sync_all.sh: line 11: send: command not found
couldn't read file "eof": no such file or directory
[root@host1(172.23.34.4)] # cat ambari_ldap_sync_all.sh
spawn ambari-server sync-ldap --existing
expect "Enter Ambari Admin login:"
expect "Enter Ambari Admin password:"
[root@host1(172.23.34.4)] # crontab -e
00 15 * * * /ambari_ldap_sync_all.sh
The unexpected benefit of this is that nobody will ever forget the LDAP password again: not will it be included in your favourite shell's history file, but anyone who can log in on that node will also be able to see those options by keeping an eye on ps. Isn't that neat?
Don't do this, kids. Never write passwords on the command line.