summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-video/motion/files/motion.initd-r2')
-rw-r--r--media-video/motion/files/motion.initd-r239
1 files changed, 39 insertions, 0 deletions
diff --git a/media-video/motion/files/motion.initd-r2 b/media-video/motion/files/motion.initd-r2
new file mode 100644
index 000000000000..c2e2740f0f4e
--- /dev/null
+++ b/media-video/motion/files/motion.initd-r2
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+extra_started_commands="reload"
+
+_create_motion_run_dir() {
+ local dir="/var/run/motion"
+ if ! [ -d "$dir" ]; then
+ mkdir -p -m750 "$dir"
+ chown ${MOTION_USER}:${MOTION_GROUP} "$dir"
+ fi
+}
+
+depend() {
+ need modules
+ after mysql
+}
+
+start() {
+ _create_motion_run_dir
+
+ ebegin "Starting motion detection"
+ start-stop-daemon --start -u ${MOTION_USER} -g ${MOTION_GROUP} --quiet --exec /usr/bin/motion
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping motion detection"
+ start-stop-daemon --stop --quiet --exec /usr/bin/motion
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading motion detection configuration"
+ start-stop-daemon --stop --signal HUP --exec /usr/bin/motion
+ eend $?
+}