Created
January 6, 2020 01:21
-
-
Save hydrian/149cf69cf663205b87896f378bd9a687 to your computer and use it in GitHub Desktop.
Updated local NSS cache from LDAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#!/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