Page 1 of 1

SUSE 9.1 Adding ZM as a service?

Posted: Mon Sep 13, 2004 1:24 am
by ajpalm
I'm trying to add ZM as a service for when the server restarts etc.

While trying to use the script that comes with the ZM package, I get the following error on SUSE 9.1

/etc/rc.d/zm start
./zm: line 6: /etc/rc.d/init.d/functions: No such file or directory

with line 6 being
. /etc/rc.d/init.d/functions

I checked and there isn't a /etc/rc.d/init.d/functions file.

Anyone got this working on SUSE 9.1?

Otherwise everything else works as it should. I just have to start it by hand.

Thanks

Andrew

Posted: Mon Sep 13, 2004 1:31 am
by ajpalm
Ok then. I've commented the above line out, and not get this error

zm start
Starting ZoneMinder: ./zm: line 17: echo_failure: command not found

I'll still keep looking. Hopefully someone has done this and has the answers :)

Posted: Mon Sep 13, 2004 1:30 pm
by lazyleopard
The scripts in init.d (wherever) tend to be very distribution-specific. You probably need to figure out how SuSE does init.d scripts, and then code one up for zoneminder. For my Debian(woody) system I've got this:

Code: Select all

#! /bin/sh
# ZoneMinder init script
# Based on skeleton by Miquel van Smoorenburg and Ian Murdock
ZM_PATH_BIN="/usr/local/bin"
PATH="$ZM_PATH_BIN:/sbin:/bin:/usr/sbin:/usr/bin"
DAEMON="$ZM_PATH_BIN/zmpkg.pl"
NAME=zm
SNAME=zoneminder
DESC="Zone Minder Webcam Daemon"
# Defaults - don't touch, edit /etc/default/zoneminder
ENABLED=0
OPTIONS=""
test -f /etc/default/zoneminder && . /etc/default/zoneminder
test "$ENABLED" != "0" || exit 0
test -f $DAEMON || exit 0
# The rest is like (almost) any other init.d script...
case "$1" in
  start)
        echo -n "Starting $DESC: "
        $DAEMON start
        RETVAL=$?
        [ $RETVAL = 0 ] || echo -n "check "
        echo -n "$NAME "
        $DAEMON status
        exit $RETVAL
        ;;
  stop)
        echo -n "Stopping $DESC: "
        $DAEMON stop
        RETVAL=$?
        [ $RETVAL = 0 ] || echo -n "check "
        echo -n "$NAME "
        $DAEMON status
        exit $RETVAL
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        $DAEMON restart
        RETVAL=$?
        [ $RETVAL = 0 ] || echo -n "check "
        echo -n "$NAME "
        $DAEMON status
        exit $RETVAL
        ;;
  status)
        echo -n "$DESC is "
        $DAEMON status
        ;;
  *)
        N=/etc/init.d/$SNAME
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0
Compare and contrast this with the zm script you've got, and the other scripts ininit.d, and maybe you'll be able to figure what to do.