I'm writing a script that acts on changes in LDAP. I want it to watch the stream of changes, and if the script gets restarted, pick up where it left off. I'm hoping to just be able to pipe ldapsearch -Esync into an LDIF parser -- instead of using the C API.
I can get all of the changes with the -Esync=ro option and stream the changes with -Esync=rp, but I can't seem to find the magic combination to pick up where it left off.
I tried the command mentioned in the "Replication from OpenLDAP to Fedora 389 DS" thread, but no matter what cookie I use (the final control value either as a base64 string or decoded) I can't seem to get it to pick up where it left off.
Is my understanding wrong or am I missing something?
This is how I understand/expect it to work:
ldapsearch ... -Esync=ro
# get everything, plus a cookie at the end.
# feed the cookie to the next command
ldapsearch ... -Esync=ro/cookie
# get everything since the last search
Any help would be greatly appreciated.