From: walter@svn.comics.unina.it
To: bismark-commits@lists.bufferbloat.net
Subject: [Bismark-commits] rev 344 - trunk/server/conf trunk/server/scripts trunk/server/src
Date: Tue, 24 May 2011 17:25:52 +0200 [thread overview]
Message-ID: <E1QOtUW-0005Yv-Ua@svn.comics.unina.it> (raw)
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
reply other threads:[~2011-05-24 15:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1QOtUW-0005Yv-Ua@svn.comics.unina.it \
--to=walter@svn.comics.unina.it \
--cc=bismark-commits@lists.bufferbloat.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox