Skip to content

Commit

Permalink
add checkversion + fix args
Browse files Browse the repository at this point in the history
  • Loading branch information
nniclausse committed Mar 17, 2006
1 parent d9f7cc9 commit b8dd041
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions manderlbot.sh.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ ERL=@ERL@
VERSION=@PACKAGE_VERSION@ VERSION=@PACKAGE_VERSION@


BOOT_SCRIPT="$INSTALL_DIR/lib/manderlbot-$VERSION/priv/manderlbot" BOOT_SCRIPT="$INSTALL_DIR/lib/manderlbot-$VERSION/priv/manderlbot"
RUN_OPTIONS="-detached -setcookie mdb" COOKIE="-setcookie mdb"
RUN_OPTIONS="-detached $COOKIE"
MANDERLBOTPATH=$INSTALL_DIR/lib/manderlbot-$VERSION/ebin MANDERLBOTPATH=$INSTALL_DIR/lib/manderlbot-$VERSION/ebin


ERTS_RUN=`$ERL -version 2>&1 | tr -d '[A-Za-z] (),\f\n\r'`
ERTS_BOOT=`grep erts $MANDERLBOTPATH/../priv/manderlbot.rel | tr -d 'a-z{}"" ,\n'`

usage() { usage() {
prog=`basename $1` prog=`basename $1`
echo "$prog start|stop|restart|status" echo "$prog start|stop|restart|status"
Expand All @@ -35,8 +39,8 @@ status() {
pid=`ps -edaf | awk '/-[s]name manderlbot/ {print $2}'` pid=`ps -edaf | awk '/-[s]name manderlbot/ {print $2}'`


if [ "zz$pid" != "zz" ]; then if [ "zz$pid" != "zz" ]; then
$ERL -sname control $RUN_OPTIONS -s mdb_control status \ $ERL -sname control -noshell $COOKIE -s mdb_control status \
-boot_var MANDERLBOTPATH $INSTALL_DIR -boot_var MANDERLBOTPATH $INSTALL_DIR -pa $MANDERLBOTPATH
echo $LOG_OPT echo $LOG_OPT
echo $CONF_OPT echo $CONF_OPT
else else
Expand All @@ -46,6 +50,21 @@ status() {
fi fi
} }


checkversion() {
if [ $ERTS_RUN != $ERTS_BOOT ]
then
echo "Erlang version has changed ! [$ERTS_BOOT] != [$ERTS_RUN]"
echo "Must create new boot files (you may have to run this one time as root ! )"
makebootfiles
fi
}

makebootfiles() {
cd $MANDERLBOTPATH/..
echo "creating boot file"
$ERL -noshell -pa $MANDERLBOTPATH -s builder go -s init stop > /dev/null
}

while getopts ":c:l:f:" Option while getopts ":c:l:f:" Option
do do
case $Option in case $Option in
Expand All @@ -57,7 +76,9 @@ do
done done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
case $1 in case $1 in
start) start;; start)
checkversion
start;;


stop) stop;; stop) stop;;


Expand Down

0 comments on commit b8dd041

Please sign in to comment.