0

I have a python application which starts a websocket on the port which is specified as a parameter to the python application. I have done the passing of argument successfully through the batch(.bat) file in windows. In windows I am passing the parameter as follows: python server.py -p 8000

Now I need to achieve the same in ubuntu 12.04 through the bash file. I am starting the python application as a service from bash file. Code of bash file:

PYPATH="/usr/bin/python"
DEAMON="./server.py"

start-stop-daemon --start --background --name $DEAMONNAME --pidfile $PIDFILE --make-pidfile  --user $USER --group $USER --chuid $USER -d $WORKINGDIR --exec $PYPATH $DEAMON 

This works fine when I run as it is, but it takes default port. I pass parameter as follows :

DEAMON="./server.py -p 8004"

This gives me following error:

start-stop-daemon: invalid option -- 'y'
Try 'start-stop-daemon --help' for more information.
...fail!

Please can any one help me in passing the parameter to the python application from bash file to achieve the same effect as in windows ?

Thanks in advance.

1

1 Answer 1

1

Move any arguments not meant directly for start-stop-daemon to the very end of the command after -- so that they are passed through:

PYPATH="/usr/bin/python"
DEAMON="./server.py -p 8004"

start-stop-daemon --start --background --name $DEAMONNAME --pidfile $PIDFILE --make-pidfile --user $USER --group $USER --chuid $USER -d $WORKINGDIR --exec $PYPATH -- $DEAMON
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.