Skip to content

Instantly share code, notes, and snippets.

@hydrian
Created January 6, 2020 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydrian/149cf69cf663205b87896f378bd9a687 to your computer and use it in GitHub Desktop.
Save hydrian/149cf69cf663205b87896f378bd9a687 to your computer and use it in GitHub Desktop.
Updated local NSS cache from LDAP
@hydrian
Copy link
Author

hydrian commented Jan 7, 2020

#!/bin/env bash
LDAP_SERVER=''
LDAP_PORT=''
if (nc -w 10 "${LDAP_SERVER}" "${LDAP_PORT}") ; then
logger -p user.info -- "Updating CCred LDAP cache from ${LDAP_SERVER}:${LDAP_PORT}"
/usr/sbin/nss_updatedb ldap 1>/dev/null
if [ $? -ne 0 ] ; then
logger -s -p user.warn -- "Failed to update CCred cache from ${LDAP_SERVER}:${LDAP_PORT}"
exit 2
fi

fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment