monsur
monsur

Reputation: 601

Nginx daemon is failing to resatrt/stop/start

I have a typical problem.

I was working on server configuration for rails using nginx and passenger. how ever i have installed the nginx passenger module.

then i configured correctly the nginx at /opt/nginx/conf directory.

Then when i try to restart/strat/reload/stop it says: Restarting nginx: /etc/init.d/nginx: line 42: start-stop-daemon: command not found.

My restart config is at /etc/init.d/nginx and there i have

restart|force-reload)
    echo -n "Restarting $DESC: "
    start-stop-daemon --stop --quiet --pidfile \
            /opt/nginx/logs/$NAME.pid --exec $DAEMON
    sleep 1
    start-stop-daemon --start --quiet --pidfile \
            /opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
    echo "$NAME."
    ;;

i am working on centos. please help me i cant figured it out why its happening. Thanks.

Upvotes: 0

Views: 2075

Answers (1)

Fleshgrinder
Fleshgrinder

Reputation: 16273

Without knowing where line 42 is, I think your problem is that you're actually passing the --exec $DAEMON argument along with the --stop argument. In all init scripts I've written so far I used start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --name ${NAME} where ${NAME} only contains the name of the executable (in our case nginx). No clue if this is your problem, no clue if this is the problem in line 42. The error message sounds like it can't find start-stop-daemon at all (which is very unlikely).

Upvotes: 1

Related Questions