#! /bin/sh DAEMON=wsdd_debug DAEMON_PATH=. PID_FILE=$DAEMON.pid DAEMON_ARGS="--pid_file $PID_FILE" # WS-Discovery param (more details see help) DAEMON_ARGS="$DAEMON_ARGS --if_name eth0" DAEMON_ARGS="$DAEMON_ARGS --type tdn:NetworkVideoTransmitter" DAEMON_ARGS="$DAEMON_ARGS --xaddr http://%s:1000/onvif/device_service" # Scope more details see in ONVIF Doc SCOPES="onvif://www.onvif.org/name/Unknown" SCOPES="$SCOPES onvif://www.onvif.org/Profile/Streaming" SCOPES="$SCOPES onvif://www.onvif.org/location/ANY" d_start() { if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE); then echo "$DAEMON already running" return 1 fi echo "Starting $DAEMON..." $DAEMON_PATH/$DAEMON $DAEMON_ARGS --scope "$SCOPES" && echo "$DAEMON started" } d_stop() { if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE"); then echo "$DAEMON not running" return 1 fi echo "Stopping $DAEMON..." kill -15 $(cat $PID_FILE) && rm -f $PID_FILE sleep 2 echo "$DAEMON stopped" } case "$1" in start) d_start ;; stop) d_stop ;; restart) echo "Restarting $DAEMON" d_stop d_start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac