Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, I have this script, called zope, which I am trying to register as a service. When I type "chkconfig --add zope", it says "service zope does not support ...
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    17

    how to run a program as a service

    Hi All,
    I have this script, called zope, which I am trying to register as a service.
    When I type "chkconfig --add zope", it says "service zope does not support chkconfig" yet when I type "service zope start", it starts zope server alright.

    When I type "chkconfig --list", no zope is in sight. If I run,
    "chkconfig --del zope", it complains with same "does not support" error.

    After registering zope, even while it was complaining, I set the run
    level ("chkconfig --levels 2345 zope on").

    Also, when I run:
    su -l $ZOPE_USER -c "${INSTANCE_HOME}/bin/instance start" > /dev/null 2>&1
    with appropriate substitution for ZOPE_USER and INSTANCE_HOME, zope starts alright.


    Does anyone see any obvious error? Or some hidden edict that I am not following?

    The file is in /etc/init.d.
    .//------------------------------
    #!/bin/sh
    # chkconfig: 2345 84 16
    #
    # Source function library.
    . /etc/rc.d/init.d/functions

    INSTANCE_HOME=/home/zope/production/testInstance

    INSTANCE_NAME=`basename ${INSTANCE_HOME}`
    ZOPE_USER=zope
    RETVAL=0

    #get config
    . /etc/sysconfig/network

    #check if network is "up"
    [ "${NETWORKING}" = no ] && exit 0

    start(){
    echo -n "Starting zope: "

    su -l $ZOPE_USER -c "${INSTANCE_HOME}/bin/instance start" > /dev/null 2>&1
    RETVAL=$?
    [ $RETVAL -eq 0 ] && success || failure
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/${INSTANCE_NAME}
    echo
    }

    # call 'em
    case "$1" in
    start)
    start
    ;;
    esac

    exit 0
    //----------------------
    Somewhere, (mail.zope.org/pipermail/zope/2001-June/092773.html)(pls add secure http in front)
    I found I could do:
    cd /etc/rc.d/rc3.d; ln -s ../init.d/zope S73zope ..... but what is this
    S73zope file? Who creates it? I don't have it in my system. (So I et error, if I type that one.)
    (Is it created when "chkconfig --levels 2345 zope on" is executed?)

    **
    Thank you for your time.

  2. #2
    Just Joined! crayfishuk's Avatar
    Join Date
    Mar 2011
    Location
    London
    Posts
    5
    I beleive chkconfig requires a description: line aswell as a chkconfig: line in order to work....

    #!/bin/sh
    # chkconfig: 2345 84 16
    # description: Zope service

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    17
    What? really?
    Ok, let me check it tomorrow-- it's night time here.
    Thank you.

  4. #4
    Just Joined!
    Join Date
    Feb 2011
    Posts
    17
    My God, crayfishuk, it works!!
    Thank you very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...