File: motion.init-FreeBSD.sh.in

package info (click to toggle)
motion 3.2.3-2.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,612 kB
  • ctags: 1,330
  • sloc: ansic: 11,669; sh: 2,906; makefile: 198
file content (30 lines) | stat: -rw-r--r-- 567 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

NAME=motion
DAEMON=@BIN_PATH@/motion
PIDFILE=/var/run/$NAME.pid

case "$1" in
start)
	if [ -x $DAEMON ] ; then 
		$DAEMON && > /dev/null && echo -n ' Starting motion'
		echo `ps axf | grep -v grep | grep $DAEMON | head -n1 | awk '{print $1}'` > $PIDFILE
	else
		echo "Daemon not found"
		echo		
	fi
	;;
stop)
	if [ -r $PIDFILE ] ; then 
		kill -15 `cat $PIDFILE` && rm $PIDFILE > /dev/null && echo -n ' Stopping motion'
	else
		echo "pidfile doesn't exist or motion stopped"
		echo
	fi
	;;
*)
	echo "Usage: `basename $0` {start|stop}" >&2
	;;
esac

exit 0