From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from svn.comics.unina.it (unknown [143.225.229.147]) by huchra.bufferbloat.net (Postfix) with ESMTP id 261C620045C for ; Tue, 24 May 2011 08:07:24 -0700 (PDT) Received: from www-data by svn.comics.unina.it with local (Exim 4.69) (envelope-from ) id 1QOtUW-0005Yv-Ua for bismark-commits@lists.bufferbloat.net; Tue, 24 May 2011 17:25:52 +0200 To: bismark-commits@lists.bufferbloat.net From: walter@svn.comics.unina.it Message-Id: Date: Tue, 24 May 2011 17:25:52 +0200 Subject: [Bismark-commits] rev 344 - trunk/server/conf trunk/server/scripts trunk/server/src X-BeenThere: bismark-commits@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Commit log for the bismark source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2011 15:07:24 -0000 Author: walter Date: 2011-05-24 17:25:52 +0200 (Tue, 24 May 2011) New Revision: 344 Modified: trunk/server/conf/bdm.conf trunk/server/scripts/bdmd trunk/server/src/Makefile Log: new bdmd wrapper Modified: trunk/server/conf/bdm.conf =================================================================== --- trunk/server/conf/bdm.conf 2011-05-24 15:10:42 UTC (rev 343) +++ trunk/server/conf/bdm.conf 2011-05-24 15:25:52 UTC (rev 344) @@ -15,10 +15,11 @@ SSH_OPTIONS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" # Files and Directories -BDMD_LOG_FILE=~/var/log/bdmd.log -BDM_DB=~/var/db/bdm.db -MSG_DB=~/var/db/msg.db -MSR_DB=~/var/db/msr.db +VAR_DIR=~/var +BDMD_LOG_FILE=$VAR_DIR/log/bdmd.log +BDM_DB=$VAR_DIR/db/bdm.db +MSG_DB=$VAR_DIR/db/msg.db +MSR_DB=$VAR_DIR/db/msr.db MYSQL_DB="bismark_live_v1" # Misc Modified: trunk/server/scripts/bdmd =================================================================== --- trunk/server/scripts/bdmd 2011-05-24 15:10:42 UTC (rev 343) +++ trunk/server/scripts/bdmd 2011-05-24 15:25:52 UTC (rev 344) @@ -20,7 +20,6 @@ Options: - -l Port number to listen on for probe packets (default: $PROBE_PORT) -h Print help screen end exit @@ -29,7 +28,7 @@ ## Main ## # Check directories -mkdir -p ~/var/log/devices/ +mkdir -p $VAR_DIR/log/devices/ # Check DB if [ ! -e $BDM_DB ]; then @@ -77,11 +76,8 @@ fi # Parse command-line -while getopts 'l:h' flag; do +while getopts 'h' flag; do case $flag in - l) - PROBE_PORT=$OPTARG - ;; h) help ;; @@ -93,23 +89,23 @@ done shift $(( OPTIND - 1 )) -pids=$(pgrep bdmd.real) +pid=$(pgrep bdmd.real) ports=$(sudo netstat -lnup | awk -F"[\t: ]*" '/bdmd.real/{ print $5 }') case $1 in start) - if [ "$( echo $ports | awk "/$PROBE_PORT/{ print \"busy\" }")" == "busy" ]; then - echo "bdmd already running on port $PROBE_PORT" + if [ "$ports" ]; then + echo "bdmd already running on ports" $ports else echo -n "Starting bdmd..." - bdmd.real $PROBE_PORT >> $BDMD_LOG_FILE 2> /tmp/bdmd.debug & + bdmd.real $PROBE_PORTS >> $BDMD_LOG_FILE 2> /tmp/bdmd.debug & sleep 1 [ "$(pgrep bdmd.real)" ] && echo "done" || echo "error" fi ;; stop) - if [ "$pids" ]; then + if [ "$pid" ]; then echo -n "Stopping bdmd..." - kill $pids + kill $pid sleep 1 [ "$(pgrep bdmd.real)" ] && echo "error" || echo "done" else @@ -118,11 +114,11 @@ ;; restart) $0 stop - $0 -l $PROBE_PORT start + $0 start ;; info) - if [ "$pids" ]; then - echo "bdmd listening on "$ports" (pids "$pids")" + if [ "$pid" ]; then + echo "bdmd listening on "$ports" (pid "$pid")" else echo "bdmd not running" fi Modified: trunk/server/src/Makefile =================================================================== --- trunk/server/src/Makefile 2011-05-24 15:10:42 UTC (rev 343) +++ trunk/server/src/Makefile 2011-05-24 15:25:52 UTC (rev 344) @@ -6,9 +6,10 @@ all: bdmd udpproxy bdmd: bdmd.c - $(CC) $(LIBS) $(CFLAGS) -lpthread -lsqlite3 $(INCLUDE) -o $@ $@.c + $(CC) $(LIBS) $(CFLAGS) -lpthread -lsqlite3 $(INCLUDE) -o $@.real $@.c udpproxy: udpproxy.c $(CC) $(LIBS) $(CFLAGS) -lpthread $(INCLUDE) -o $@ $@.c - +clean: + rm bdmd.real udpproxy