miniupnp/minissdpd/testminissdpdnotif.sh

27 lines
540 B
Bash
Raw Normal View History

#!/bin/sh
# $Id: $
# (c) 2016 Thomas Bernard
OS=`uname -s`
IF=lo
if [ "$OS" = "Darwin" ] ; then
IF=lo0
fi
# if set, 1st argument is network interface
if [ -n "$1" ] ; then
IF=$1
fi
2016-01-17 23:19:50 +00:00
# trap sigint in the script so CTRL-C interrupts the running program,
# not the script
trap 'echo SIGINT' INT
SOCKET=`mktemp -t minissdpdsocketXXXXXX`
PID="${SOCKET}.pid"
./minissdpd -s $SOCKET -p $PID -i $IF || exit 1
2016-01-17 23:19:50 +00:00
sleep .5
echo "minissdpd process id `cat $PID`"
./showminissdpdnotif -s $SOCKET
echo "showminissdpdnotif returned $?"
kill `cat $PID`