LDIF: Modify attr if exists; Add if not exists
Solution 1:
The right way to do this is simply using the replace action
dn: ...
changetype: modify
replace: attributeName
attributeName: xxx
Solution 2:
ldapmodify
has a -c
flag:
-c continuous operation mode (do not stop on errors)
... which I guess should take care of your first point.