Commit fb4adde2 authored by 's avatar

added a script, checking for execution of daemons mapid & mapicommd. Cron...

added a script, checking for execution of daemons mapid & mapicommd. Cron daemon can run it for reconnection purposes

git-svn-id: file:///home/svn/mapi/trunk@1198 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 9b334cd9
......@@ -244,6 +244,8 @@ if test x$reconnect = xtrue; then
else
AC_MSG_RESULT(no)
fi
# for etc/Makefile.am
AM_CONDITIONAL(RECONNECTION_IS_ENABLED, test x$reconnect = xtrue)
# SSL sockets (only for DiMAPI)
if test x$dimapi = xtrue; then
......
......@@ -19,19 +19,32 @@ if BINARY_DAGFLIB
$(INSTALL) -m 755 dag_ipf_loader.sh.example $(DESTDIR)$(sbindir)
endif
install-data-local:
# ssl stuff
if SSL_IS_ENABLED
install-data-local:
echo "Generating SSL keys"
openssl genrsa -out mapicommd_key.pem 1024 2> /dev/null
openssl req -new -x509 -days 30000 -key mapicommd_key.pem -out mapicommd_cert.pem -config mapicommd_cert.cnf
${INSTALL} -m 600 mapicommd_key.pem $(DESTDIR)$(confdir)/mapicommd_key.pem
${INSTALL} -m 600 mapicommd_cert.pem $(DESTDIR)$(confdir)/mapicommd_cert.pem
rm mapicommd_key.pem mapicommd_cert.pem
endif
# reconnection stuff
if RECONNECTION_IS_ENABLED
${INSTALL} -m 700 reconnection.sh $(DESTDIR)$(confdir)/reconnection.sh
endif
uninstall-local:
# ssl stuff
if SSL_IS_ENABLED
rm -f $(DESTDIR)$(confdir)/mapicommd_key.pem
rm -f $(DESTDIR)$(confdir)/mapicommd_cert.pem
endif
EXTRA_DIST = createlib.pl funct_template.c mapicommd_cert.cnf
# reconnection stuff
if RECONNECTION_IS_ENABLED
rm -f $(DESTDIR)$(confdir)/reconnection.sh
endif
EXTRA_DIST = createlib.pl funct_template.c mapicommd_cert.cnf reconnection.sh
#!/bin/bash
# For reconnection purposes, just append the following line
# */1 * * * * root /usr/local/etc/mapi/reconnection.sh >> a_possible_file_for_output_messages
# to file: /etc/crontab
# Cron daemon (crond) will run reconnection.sh script, every one minute, checking
# for execution of daemons mapid and mapicommd. If mapid and/or mapicommd, stops its
# execution, it will be executed automatically, from the script.
# When the connection with mapi daemons is restored, the monitoring applications
# will continue automatically their execution.
mapid=`ps -A | grep mapid | awk ' { print $4 } '`
mapicommd=`ps -A | grep mapicommd | awk ' { print $4 } '`
if [ -n "$mapid" ] # mapid is running or not ???
then
date=`/bin/date`
echo -e "\n\t *** mapid is running *** ($date)\n"
else
date=`/bin/date`
echo -e "\n\t *** mapid is out of execution *** ($date)\n"
/usr/local/sbin/mapid -d # run mapid as daemon
fi
if [ -n "$mapicommd" ] # mapicommd is running or not ???
then
date=`/bin/date`
echo -e "\n\t *** mapicommd is running *** ($date)\n"
else
date=`/bin/date`
echo -e "\n\t *** mapicommd is out of execution *** ($date)\n"
/usr/local/sbin/mapicommd -d # run mapicommd as daemon
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment