Last Updated: April 30, 2016
·
4.092K
· petems

start-stop-daemon: invalid option -- 'j'

Something I kept getting when I was trying to make an upstart script for a custom ubuntu package, and googling it I saw a lot of people running into a similar issue.

I kept getting the following error when I was looking into

start-stop-daemon: invalid option -- 'j'

when I was doing

script
    exec start-stop-daemon  --start \
                        --chuid $USER:$GROUP \
                        --make-pidfile --pidfile $HOME/foo.pid \
                        --chdir $HOME \
                        --exec /usr/lib/jvm/java-7-openjdk-amd64/bin/java -jar foo.jar
end script

Turns out it interprets the -jar weirdly, and thinks it's an option you're trying to add. So you have to escape with -- like so

script
    exec start-stop-daemon  --start \
                        --chuid $USER:$GROUP \
                        --make-pidfile --pidfile $HOME/foo.pid \
                        --chdir $HOME \
                        --exec /usr/lib/jvm/java-7-openjdk-amd64/bin/java -- -jar foo.jar
end script

Later on I realised it would be easier to actually use a bash script to run the program and just run it from the upstart script, but anyways...

1 Response
Add your response

Nice! I forgot about the extra --

What it does is say "pass the arguments into the program that I am calling" rather than "apply these arguments to his call"

I probably explained that horribly...

over 1 year ago ·