Debian Codegraph @

examples/port_publisher.sh

raw
1 #! /bin/sh
2 # daemon starter script
3 # based on skeleton from Debian GNU/Linux
4 # cliechti at gmx.net
5
6 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7 DAEMON=/usr/local/bin/port_publisher.py
8 NAME=port_publisher
9 DESC="serial port avahi device publisher"
10
11 test -f $DAEMON || exit 0
12
13 set -e
14
15 case "$1" in
16 start)
17 echo -n "Starting $DESC: "
18 $DAEMON --daemon --pidfile /var/run/$NAME.pid
19 echo "$NAME."
20 ;;
21 stop)
22 echo -n "Stopping $DESC: "
23 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
24 # \ --exec $DAEMON
25 echo "$NAME."
26 ;;
27 restart|force-reload)
28 echo -n "Restarting $DESC: "
29 start-stop-daemon --stop --quiet --pidfile \
30 /var/run/$NAME.pid
31 # --exec $DAEMON
32 sleep 1
33 $DAEMON --daemon --pidfile /var/run/$NAME.pid
34 echo "$NAME."
35 ;;
36 *)
37 N=/etc/init.d/$NAME
38 echo "Usage: $N {start|stop|restart|force-reload}" >&2
39 exit 1
40 ;;
41 esac
42
43 exit 0
44