Script and cron job to verify the ldap status on the rstudio servers. See https://support.d4science.org/issues/12949

This commit is contained in:
Andrea Dell'Amico 2018-11-29 14:50:03 +01:00
parent 8156a3883b
commit 5dd9e01fd3
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#!/bin/bash
NSCD_SERVICE="nscd"
NSLCD_SERVICE="nslcd"
SERVICE_CMD="/usr/sbin/service"
RETVAL=
CHECK_USER=$( id pasquale.pagano )
RETVAL=$?
restart_ns_services() {
$SERVICE_CMD $NSCD_SERVICE restart > /dev/null 2>&1
$SERVICE_CMD $NSLCD_SERVICE restart > /dev/null 2>&1
logger "check_ldap_users: Restarted the $NSCD_SERVICE and $NSLCD_SERVICE services."
}
if [ $RETVAL -ne 0 ] ; then
logger "check_ldap_users: The ldap connection is broken"
restart_ns_services
fi
exit 0

View File

@ -123,6 +123,14 @@
- Restart the NSCD service - Restart the NSCD service
tags: [ 'smartgears', 'r_connector', 'tomcat', 'r_connector_nslcd_conf' ] tags: [ 'smartgears', 'r_connector', 'tomcat', 'r_connector_nslcd_conf' ]
- name: Install a script that checks if the ldap authentication is working, and if not it restarts the ns(l)cd daemons
copy: src=check_ldap_users dest=/usr/local/bin/check_ldap_users owner=root group=root mode=0555
tags: [ 'smartgears', 'r_connector', 'tomcat', 'r_connector_check_ldap' ]
- name: Add a cron job that runs the ldap users check script
cron: name="check ldap users" job="/usr/local/bin/check_ldap_users" state=present user=root
tags: [ 'smartgears', 'r_connector', 'tomcat', 'r_connector_check_ldap' ]
when: when:
- r_connector_install - r_connector_install
- r_connector_ldap_enabled - r_connector_ldap_enabled