Capturing both stdout and stderr from ldapmodify

Or ldapsearch, actually. Syntax follows.

Making a note of this because I actually forgot how to do it and stumbled around before checking one of my older scripts.

ldapmodify -h localhost -D "cn=directory manager" -w xxxx -c -f changes.ldif >ops.log 2>&1

That’s all there is to it. The key is in the “2>&1” at the end, which captures stderr and pipes it to stdout for inclusion of both in your log file.

This entry was posted in Directory, Identity Management on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).