* [Bismark-commits] rev 344 - trunk/server/conf trunk/server/scripts trunk/server/src
@ 2011-05-24 15:25 walter
0 siblings, 0 replies; only message in thread
From: walter @ 2011-05-24 15:25 UTC (permalink / raw)
To: bismark-commits
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 <prb_port> 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-24 15:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 15:25 [Bismark-commits] rev 344 - trunk/server/conf trunk/server/scripts trunk/server/src walter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox