summaryrefslogtreecommitdiff
path: root/package/motion/files/motion.init
diff options
context:
space:
mode:
Diffstat (limited to 'package/motion/files/motion.init')
-rw-r--r--package/motion/files/motion.init27
1 files changed, 27 insertions, 0 deletions
diff --git a/package/motion/files/motion.init b/package/motion/files/motion.init
new file mode 100644
index 000000000..1c8b7e705
--- /dev/null
+++ b/package/motion/files/motion.init
@@ -0,0 +1,27 @@
+#!/bin/sh
+#PKG motion
+#INIT 80
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${motion:-NO}" = x"NO" && exit 0
+ exec sh $0 start
+ ;;
+start)
+ [ -f /etc/motion.conf ] || exit
+ /usr/bin/motion
+ ;;
+stop)
+ kill $(pgrep -f /usr/bin/motion)
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ ;;
+esac
+exit $?