diff options
Diffstat (limited to 'main/zoneminder/zoneminder.initd')
-rw-r--r-- | main/zoneminder/zoneminder.initd | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/main/zoneminder/zoneminder.initd b/main/zoneminder/zoneminder.initd new file mode 100644 index 0000000000..ce600fdb54 --- /dev/null +++ b/main/zoneminder/zoneminder.initd @@ -0,0 +1,47 @@ +#!/sbin/runscript + +# init.d file for zoneminder +# Copyright (c) 2013 Kaarle Ritvanen + +name=zoneminder +command=/usr/bin/zmpkg.pl +extra_commands=setup + +depend() { + need apache2 + after mysql +} + +start() { + ebegin "Starting $name" + if status > /dev/null; then + ewarn "$name already started" + else + $command start + fi + eend $? +} + +stop() { + ebegin "Stopping $name" + if status > /dev/null; then + $command stop + else + ewarn "$name already stopped" + fi + eend $? +} + +status() { + status=$($command status) + echo $status + [ "$status" = running ] +} + +setup() { + . /etc/zm.conf + ebegin "Initializing $name database" + mysql -h $ZM_DB_HOST -u $ZM_DB_USER -p$ZM_DB_PASS \ + < $ZM_PATH_DATA/db/zm_create.sql + eend $? +} |