Created
December 2, 2014 14:19
-
-
Save gregneagle/e2a92a60407ebc2d4627 to your computer and use it in GitHub Desktop.
loginhooks
This file contains hidden or 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
#!/bin/sh | |
# Master login hook script | |
# | |
# runs each script found in the login hooks directory | |
LOGINHOOKSDIR="/etc/hooks/login" | |
if [ -d ${LOGINHOOKSDIR} ]; then | |
for script in ${LOGINHOOKSDIR}/* ; do | |
if [ -s ${script} -a -x ${script} ]; then | |
logger -s -t LoginHook -p user.info Executing ${script}... 1>&2 | |
# run the item | |
${script} $* | |
rc=$? | |
if [ $rc -ne 0 ]; then | |
logger -s -t LoginHook -p user.info ${script} failed with return code ${rc} 1>&2 | |
exit $rc | |
fi | |
fi | |
done | |
fi | |
This file contains hidden or 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
# ls -alr /etc/hooks | |
total 16 | |
-rwxr-xr-x 1 root wheel 607 Mar 11 2005 logouthook | |
drwxr-xr-x 2 root wheel 68 Jan 13 2010 logout | |
-rwxr-xr-x 1 root wheel 599 Mar 11 2005 loginhook | |
drwxr-xr-x 5 root wheel 170 Jul 31 2013 login | |
drwxr-xr-x 118 root wheel 4012 Dec 2 06:08 .. | |
drwxr-xr-x 6 root wheel 204 Jul 31 2013 . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment