#!/sbin/runscript # init.d file for zoneminder # Copyright (c) 2013 Kaarle Ritvanen name=zoneminder command=/usr/bin/zmpkg.pl extra_commands="setup" depend() { after mysql } start() { ebegin "Starting $name" if status > /dev/null; then ewarn "$name already started" else prepare $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 $? } prepare() { . /etc/zm.conf install -d -o $ZM_WEB_USER -g $ZM_WEB_GROUP \ /var/run/zoneminder chown $ZM_WEB_USER:$ZM_WEB_GROUP \ /var/lib/zoneminder/* \ /var/log/zoneminder }