Skip to content
Snippets Groups Projects
Commit 5f7f9c65 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Cover up some mail.ru porn in RPM scripts.

When server wrapper script failed to start
the server, it used to try to send a email
to somebody about this. This has never been
tested, nor used.

At least make sure it works when it does try
to do it.
parent f920175c
No related branches found
No related tags found
No related merge requests found
#!/bin/sh -x
# A wrapper script to run a single tarantool instance
# and restart it when it crashes
export PATH=$PATH:/usr/local/bin
NAME="tarantool_box"
......@@ -8,12 +11,17 @@ INST=$(basename $0 .sh)
CONF="/usr/local/etc/${INST}.cfg"
LOGDIR="/var/${INST}/logs"
WRAP_PIDFILE="/var/${INST}/wrapper.pid"
# set to get restart emails
#MAILTO=""
exec <&-
report()
{
tail -n 500 ${LOGDIR}/tarantool.log | mail -s "${@}" ${MAILTO}
if [ "${MAILTO}" ]; then
tail -n 500 ${LOGDIR}/tarantool.log | mail ${MAILTO} -s "\"${INST} is restarted\""
fi
echo \""${@}"\" >> ${LOGDIR}/wrapper.log
}
runtarantool()
......@@ -22,18 +30,17 @@ runtarantool()
${BINARY} ${OPTIONS} --config ${CONF} 2>&1 </dev/null &
wait
RC=${?}
report "${INST} restarted! "`date '+%Y-%m-%d %H:%M:%S'`" exit code $RC"
echo "${INST} restarted! "`date '+%Y-%m-%d %H:%M:%S'`" exit code $RC<br>" >> /var/tmp/error.txt
report "${INST}: ${BINARY} ${OPTIONS} --config ${CONF} died prematurely "`date '+%Y-%m-%d %H:%M:%S'`" exit code $RC"
sleep 2
}
{
ulimit -Hc unlimited
ulimit -c unlimited
runtarantool
while true
do
ulimit -Hc 0
ulimit -c 0
runtarantool
done
} &
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment