| Location data | |
| maintainer | Robot Vision Lab |
| machine | rvl2.ecn.purdue.edu |
| mechanism | crontab |
| check script | /home/rvl2/d/asldata/bin/jsrvr.chk |
| ASL Server start script | /home/rvl2/d/asldata/bin/jsrvr.start |
| check interval | 5 minutes |
| log files | |
| startup | /home/rvl2/d/asldata/JDBC/tmp/JDBCServer.log |
| ASL Server | /tmp/JDBCServer.out |
| MySQL Server | /tmp/mysqld.log |
To edit the crontab file, use
bash # (Unless you use this by default) export EDITOR=emacs crontab -e
The crontab file contains a single line:
0 11 * * * * /home/rvl2/d/asldata/bin/jsrvr.chk
To forward any errors the crontab file makes to your personal web account, use
cd ~/ echo 'username@location.com' > .forward
All of this is documented in the jsrvr.chk file, as well:
/bin/jsrvr.chk
#!/bin/sh
#
# Shell Script for Starting the RVL-SLLL ASL Database Automatically
#
# Josiah Yoder
# This shell script is called from a script automatically, using crontab.
# To edit:
# export EDITOR=emacs
# crontab -e
# The current file contains exactly one line (and ends with a newline):
# 0 11 * * * /home/rvl2/d/asldata/bin/jsrvr.chk
#
# Things that did not seem to work:
# * Trying to detect using grep "java" | grep "asldata", because all processes use "asldata"
# * Trying to detect when the bash file is running using grep "jsrvr.start"
# (Even with the use | grep -v "grep")
#
#
# Check if server is alive, restart if necessary
PID=`ps -Af | grep "java -classpath .:/home/rvl2/d/asldata/" | grep -v "grep"`
LOG=/home/rvl2/d/asldata/JDBCServer.log
if [ ! -n "$PID" ]; then
## Pre-Apr 2008 version (replaced by the jsrvr.start call)
# java JDBCServer > /tmp/JDBCServer.out 2>&1 &
/home/rvl2/d/asldata/bin/jsrvr.start > /tmp/JDBCServer.out 2>&1 &
date=`/bin/date '+%a %b %e %T'`
echo "$date: Server down. Restarted it." >> $LOG
else
date=`/bin/date '+%a %b %e %T'`
echo "$date: Server up." >> $LOG
fi
# Check if mysql is alive, restart if necessary
PID=`pgrep "mysqld"`
LOG=/home/rvl2/d/asldata/JDBCServer.log
if [ ! -n "$PID" ]; then
/usr/local/libexec/mysqld --datadir=/home/rvl2/a/mysql > /tmp/mysqld.log 2>&1 &
date=`/bin/date '+%a %b %e %T'`
echo "$date: mysqld down. restarted it." >> $LOG
else
date=`/bin/date '+%a %b %e %T'`
echo "$date: mysqld up." >> $LOG
fi
The script for starting the ASL Server is
/bin/jsrvr.start
#!/bin/sh cd /home/rvl2/d/asldata/ASLdatabaseSearch/server; java -classpath .:/home/rvl2/d/asldata/public-web/mysql-connector-java-3.1.10-bin.jar JDBCServer