I have been trying to make an init script using start-stop-daemon. I am stuck on the arguments to the daemon. I want to keep these in a variable at the top of the script but
I thought I'd post the final quotations used in my working init script:
COMMAND="/path/to/script -opt param param2 param3"
DAEMON_OPTS=" 0.0.0.0:$PORT -dest $OUTPUT_DIRECTORY -command"
start-stop-daemon --start --background --make-pidfile --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS "\"$COMMAND\""
Obviously an incomplete and non-functional example but I hope you get the gist of it. The double quotations with the inner pair escaped is what did the trick.