3

Hi I'm really new to writing scripts and I searched a lot but all that I've found is scripts with full access. I don't have access to the /etc. I'm working in a host in the cloud but I have limited access this is why all my attempts were unsuccessful. So far I have this:

    #!/bin/sh
    prog="supervisord"
    prefix="/usr/local/"
    exec_prefix="${prefix}"
    prog_bin="${exec_prefix}/bin/supervisord -c /home/user/supervisor/supervisord.conf"
    PIDFILE="/var/run/$prog.pid"

    start()
    {
    echo -n $"Starting $prog: "
    daemon $prog_bin --pidfile $PIDFILE
    [ -f $PIDFILE ] && success $"$prog startup" || failure $"$prog startup"
    echo
    }

    stop()
    {
    echo -n $"Shutting down $prog: "
    [ -f $PIDFILE ] && killproc $prog || success $"$prog shutdown"
    echo
    }

    case "$1" in

    start)
    start
    ;;

    stop)
     stop
    ;;

    status)
    status $prog
    ;;

    restart)
    stop
    start
    ;;

    *)
    echo "Usage: $0 {start|stop|restart|status}"
    ;;

    esac

But I always get this error:

   Starting supervisord: script.sh: 27: script.sh: daemon: not found
   script.sh: 28: script.sh: failure: not found

Please help I have no idea what is going on ...

2
  • 3
    ServerFault questions pertain to server administration in a professional context. If you do not have access to /etc, then you are not an administrator of the system.
    – Andrew B
    Commented May 5, 2014 at 20:43
  • It seems that you have a misconfiguration in your supervisor config file.
    – cuonglm
    Commented May 6, 2014 at 1:37

1 Answer 1

1

It looks like you got your example (init.d) script from something that uses the program daemon to daemonize other—non-daemon—programs, and you are missing that program.

I don't have daemon installed (Ubuntu 12.04), and you don't need it for supervisord. You can use --pidfile=FILE directly on supervisord itself an it will daemonize itself unless directed otherwise.

You should check if you can write to /var/run/supervisord.pid, or otherwise specify a different, accessible, location.

You must log in to answer this question.