Results 1 to 10 of 11
I'd like to run a Python / Django program as a init.d startup script. The script line is:
python manage.py runserver 192.168.0.2:8181
The problem: when it runs it spits out ...
- 09-18-2007 #1Just Joined!
- Join Date
- Sep 2007
- Location
- Rio de Janeiro, Brasil
- Posts
- 6
Running python script on boot
I'd like to run a Python / Django program as a init.d startup script. The script line is:
python manage.py runserver 192.168.0.2:8181
The problem: when it runs it spits out messages to the console until I kill it with Ctrl C.
How can I change the script or add some pipes to overcome this problem ?
Any comments or suggestion is welcome!
Thanks in advance,
Josir Gomes
Rio de Janeiro - Brasil
- 09-18-2007 #2Linux User
- Join Date
- Aug 2006
- Posts
- 458
you can try putting into background ? using &
- 09-18-2007 #3
Or try sending the output to /dev/null?
GilesCode:python manage.py runserver 192.168.0.2:8181 > /dev/null
"Our greatest fear is not that we are powerless. Our greatest fear is Microsoft"
Registered linux user #391027
- 09-18-2007 #4Just Joined!
- Join Date
- Sep 2007
- Location
- Rio de Janeiro, Brasil
- Posts
- 6
Hi folks, thanks for replying.
/dev/null will not work. It will simply omit the output but it will wait for a input anyway.
How can I use the & in the init.d script?
Where can I find some info about backgrounding the script?
Thanks in advance,
Josir Gomes
- 09-19-2007 #5Linux User
- Join Date
- Aug 2006
- Posts
- 458
- 09-19-2007 #6Just Joined!
- Join Date
- Sep 2007
- Location
- Rio de Janeiro, Brasil
- Posts
- 6
Ginap
Hi Ghostdog,
GINAP: Google Is Not A Professional...
That is, if Google could solve everything, we would not need a forum...
if you read carefully, you will see that I want to use the "&" with the update.rc command and init.d procedures.
Let me explain myself better: "What are the pitfalls if I use the & inside my script and deploy it with update.rc ? Is this correct in the LSB directives ?"
Thanks anyway: with your post, I could explain better my doubt.
Josir Gomes
- 09-20-2007 #7Linux User
- Join Date
- Aug 2006
- Posts
- 458
you may be right, but it does solve most things, if you know how to find.
no where in your posts did you say you want to use it with update.rc, or have i missed it?if you read carefully, you will see that I want to use the "&" with the update.rc command and init.d procedures.
i don't have update.rc, so i won't comment on thisLet me explain myself better: "What are the pitfalls if I use the & inside my script and deploy it with update.rc ? Is this correct in the LSB directives ?"
Thanks anyway: with your post, I could explain better my doubt.
Josir Gomes
please try this and see. :
Otherwise, you can also code your python script (or runserver? ) to run as a daemon, since its function is a server , right?Code:python manage.py runserver 192.168.0.2:8181 &
- 09-20-2007 #8
I'm not sure how to get it to run automatically, but if you use KDE or Gnome you can launch it into the background by pressing ALT+F2 and launching it there via command. The output won't be displayed in any terminal window.
- 09-27-2007 #9Just Joined!
- Join Date
- Sep 2007
- Location
- Rio de Janeiro, Brasil
- Posts
- 6
Python/Django during boot time.
Hi netstrider,
thanks for replying but your tip does not apply. This application will run 24x7. I have to run it during boot time.
Hi ghostdog74, thanks for replying. I did:
python manage.py runserver 192.168.0.2:8181 &
but it still asks for CTRL-C during boot.
How can I add the command as deamon. Do you have a tutorial or documentation?
Josir.
- 09-27-2007 #10Linux User
- Join Date
- Aug 2006
- Posts
- 458
have you read Django documents...you might be able to find out how to run the server in daemon mode.? have a try


Reply With Quote
