mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-23 06:06:11 +00:00
Updated build script and added scripts to test UDP connections (useful if not sure if firewall is open or a great firewall restricts access)
This commit is contained in:
@@ -160,6 +160,11 @@ if [[ "$@" == "hot-deploy" ]]; then
|
||||
|
||||
# check telnet port connection
|
||||
TELNET_ACTIVE=`netstat -tlnp 2>/dev/null | grep ":$OSGI_TELNET_PORT"`
|
||||
if [[ $TELNET_ACTIVE == "" ]]; then
|
||||
# some BSD systems do not support -p
|
||||
TELNET_ACTIVE=`netstat -an | grep ".$OSGI_TELNET_PORT"`
|
||||
fi
|
||||
|
||||
if [[ $OSGI_TELNET_PORT == "" ]] || [[ $TELNET_ACTIVE == "" ]]; then
|
||||
echo ""
|
||||
echo "ERROR: Could not find any process running on port $OSGI_TELNET_PORT. Make sure your server has been started with -console $OSGI_TELNET_PORT"
|
||||
@@ -178,12 +183,21 @@ if [[ "$@" == "hot-deploy" ]]; then
|
||||
fi
|
||||
|
||||
# first get bundle ID
|
||||
echo -n "Connecting to OSGi server..."
|
||||
NC_CMD="nc -t 127.0.0.1 $OSGI_TELNET_PORT"
|
||||
echo "OK"
|
||||
OLD_BUNDLE_INFORMATION=`echo -n ss | $NC_CMD | grep ${OSGI_BUNDLE_NAME}_`
|
||||
BUNDLE_ID=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 1`
|
||||
OLD_ACTIVATED_NAME=`echo $OLD_BUNDLE_INFORMATION | cut -d " " -f 3`
|
||||
echo "Could identify bundle-id $BUNDLE_ID for $OLD_ACTIVATED_NAME"
|
||||
|
||||
read -s -n1 -p "I will now stop bundle $OLD_BUNDLE_INFORMATION with id $BUNDLE_ID - is this right? (y/N): " answer
|
||||
case $answer in
|
||||
"Y" | "y") echo "Continuing";;
|
||||
*) echo "Aborting..."
|
||||
exit;;
|
||||
esac
|
||||
|
||||
# stop and uninstall
|
||||
echo -n stop $BUNDLE_ID | $NC_CMD > /dev/null
|
||||
echo -n uninstall $BUNDLE_ID | $NC_CMD > /dev/null
|
||||
@@ -278,6 +292,14 @@ if [[ "$@" == "install" ]] || [[ "$@" == "all" ]]; then
|
||||
mkdir $ACDIR/plugins
|
||||
fi
|
||||
|
||||
if [ ! -d "$ACDIR/logs" ]; then
|
||||
mkdir $ACDIR/logs
|
||||
fi
|
||||
|
||||
if [ ! -d "$ACDIR/tmp" ]; then
|
||||
mkdir $ACDIR/tmp
|
||||
fi
|
||||
|
||||
if [ ! -d "$ACDIR/configuration" ]; then
|
||||
mkdir $ACDIR/configuration
|
||||
fi
|
||||
@@ -316,6 +338,7 @@ if [[ "$@" == "install" ]] || [[ "$@" == "all" ]]; then
|
||||
|
||||
cp -v $PROJECT_HOME/java/target/start $ACDIR/
|
||||
cp -v $PROJECT_HOME/java/target/stop $ACDIR/
|
||||
cp -v $PROJECT_HOME/java/target/udpmirror $ACDIR/
|
||||
|
||||
echo "Installation complete. You may now start the server using ./start"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import socket
|
||||
|
||||
UDP_IP = "195.227.44.85"
|
||||
UDP_PORT = 2013
|
||||
MESSAGE = "Hello, World!"
|
||||
|
||||
print "UDP target IP:", UDP_IP
|
||||
print "UDP target port:", UDP_PORT
|
||||
print "message:", MESSAGE
|
||||
|
||||
sock = socket.socket(socket.AF_INET, # Internet
|
||||
socket.SOCK_DGRAM) # UDP
|
||||
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
|
||||
@@ -0,0 +1,13 @@
|
||||
import socket
|
||||
|
||||
UDP_IP = "195.227.44.85"
|
||||
UDP_PORT = 2013
|
||||
|
||||
sock = socket.socket(socket.AF_INET, # Internet
|
||||
socket.SOCK_DGRAM) # UDP
|
||||
sock.bind((UDP_IP, UDP_PORT))
|
||||
|
||||
print "Listening on 195.227.44.85 port %s" % UDP_PORT
|
||||
while True:
|
||||
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
|
||||
print "received message:", data
|
||||
Reference in New Issue
Block a user