Permalink
Browse files

check if config file exist

SVN Revision: 281
  • Loading branch information...
1 parent 483dc82 commit 7fbd71d7058a6443b8aee63aea7a41c50299bcb3 @nniclausse nniclausse committed Mar 31, 2004
Showing with 20 additions and 8 deletions.
  1. +20 −8 idx-tsunami.sh.in
View
@@ -17,7 +17,7 @@ TSUNAMIPATH=%INSTALL_DIR%/lib/tsunami-$VERSION/ebin
CONTROLLERPATH=%INSTALL_DIR%/lib/tsunami_controller-$VERSION/ebin
RECORDERPATH=%INSTALL_DIR%/lib/tsunami_recorder-$VERSION/ebin
-CONF_OPT="-tsunami_controller config_file \"$HOME/.idx-tsunami/idx-tsunami.xml\""
+CONF_OPT_FILE="$HOME/.idx-tsunami/idx-tsunami.xml"
BOOT_OPT="-boot %INSTALL_DIR%/lib/tsunami_controller-$VERSION/priv/tsunami_controller"
REC_BOOT_OPT="-boot %INSTALL_DIR%/lib/tsunami_recorder-$VERSION/priv/tsunami_recorder"
REC_DEBUG_LEVEL=5
@@ -34,8 +34,8 @@ stop_recorder() {
start() {
echo "Starting IDX-Tsunami"
- erl $ERL_OPTS -detached -sname $CONTROLLER -setcookie $COOKIE $BOOT_OPT $CONF_OPT \
- -tsunami_controller $LOG_OPT
+ erl $ERL_OPTS -detached -sname $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
+ -tsunami_controller config_file \"$CONF_OPT_FILE\" -tsunami_controller $LOG_OPT
}
recorder() {
@@ -47,24 +47,34 @@ recorder() {
-tsunami_recorder proxy_listen_port $LISTEN_PORT
}
+debug() {
+ erl $ERL_OPTS -sname $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
+ -tsunami_controller config_file \"$CONF_OPT_FILE\" -tsunami_controller $LOG_OPT
+}
+
+checkconfig() {
+ if [ ! -e $CONF_OPT_FILE ]
+ then
+ echo "Config file $CONF_OPT_FILE doesn't exist, aborting !"
+ exit 1
+ fi
+}
+
maindir() {
if [ ! -d $MAIN_DIR ]
then
echo "Creating local tsunami directory $MAIN_DIR"
mkdir $MAIN_DIR
fi
}
+
logdir() {
if [ ! -d $LOG_DIR ]
then
echo "Creating idx-tsunami log directory $LOG_DIR"
mkdir $LOG_DIR
fi
}
-debug() {
- erl $ERL_OPTS -sname $CONTROLLER -setcookie $COOKIE $BOOT_OPT $CONF_OPT \
- -tsunami_controller $LOG_OPT
-}
status() {
echo "status: not yet implemented"
@@ -79,7 +89,7 @@ usage() {
while getopts ":f:l:d:" Option
do
case $Option in
- f) CONF_OPT="-tsunami_controller config_file \"$OPTARG\" ";;
+ f) CONF_OPT_FILE=$OPTARG;;
l) LOG_OPT="log_file \"$OPTARG\" ";;
d) REC_DEBUG_LEVEL=$OPTARG;;
*) usage ;;
@@ -89,6 +99,7 @@ shift $(($OPTIND - 1))
case $1 in
start)
+ checkconfig
maindir
logdir
start
@@ -101,6 +112,7 @@ case $1 in
;;
debug)
+ checkconfig
maindir
logdir
debug

0 comments on commit 7fbd71d

Please sign in to comment.