2

I wrote an init script to execute last that will start some pythjon script. The Python script will just run and never terminate and this makes my little linux box (getty terminal on tty) to just outpout the script but never the login prompt. I made the mistake to not assign a fix ip so i basically had to start over again (re-download the initial build onto the flash). However now I'm wondering what different possibilities I have, is it enough to launch the script in my init script with a & at the end or do I need a nohup/ What's the best way to resolve this?

Thank you! Ron

Shog9
  • 156,901
  • 35
  • 231
  • 235
stdcerr
  • 13,725
  • 25
  • 71
  • 128

2 Answers2

2

I got this resolved by directing the output of the script to /dev/null and adding an ampersand at the end kinda like

myscript.sh > /dev/null &

this will return control to the shell and keep executing the script in the back without reporting the results to stdout.

stdcerr
  • 13,725
  • 25
  • 71
  • 128
0

Yes, you need to make sure you init startup script returns. It's good to follow the LSB documentation and have a script that excepts standard actions like start, stop, status and make it return proper return codes.

Launching the python script in the background with an & at the end of the command should be sufficient. You may also want to take a look at the command start-stop-daemon to start your process.

Bernhard
  • 8,583
  • 4
  • 41
  • 42