#!/bin/sh
#
# Startup script for local custom services

case $1 in
    start)
        echo "Starting blueproximity.sh"
        su pavel -c "exec nice sh ~pavel/btproximity/blueproximity.sh" >/dev/null 2>&1 &
    ;;
    stop)
        pid=`pgrep -f blueproximity.sh`
        if [ -n "$pid" ] ; then
          echo "Stopping blueproximity.sh"
          kill $pid
        fi
    ;;
    restart)
        $0 stop
        sleep 1
        $0 start
    ;;
    *)
        echo "usage: $0 (start|stop|restart)"
        exit 1
    ;;
esac
