1

The problem is that if I execute a command (eg. a Python script), the terminal or script is waiting until the program return a exit status so that it can continue or return to terminal. Is there a way to circumvent this?

1
  • You could run it in the background, just do: ./command.py &
    – jgr
    Jan 14, 2013 at 20:00

3 Answers 3

3

In most shells, you can launch commands or processes in the background by appending an ampersand (&) to the command:

python file.py &
1
  • Already tried this but it does not work.
    – user1527118
    Jan 14, 2013 at 20:22
1

Several choices:

  1. Run it in screen. man screen, screen, myprorgamm, C-a d, screen -r.
  2. nohup myprogramm
  3. myprogramm &
4
  • Tried: $ screen _command_, $ nohup _command_ $ _command_ &. Nothing worked so far.
    – user1527118
    Jan 14, 2013 at 20:19
  • You need to start screen separately first; and if you don’t have screen, install it first.
    – poke
    Jan 14, 2013 at 20:20
  • 1
    for screen - start with man screen, it's complex app with lots and lots of functionality. nohup and & (aka detach) can't "not work", really. if there is any error - make sure to post it here.
    – iced
    Jan 14, 2013 at 20:23
  • Hey, the amperstand workaround is working, but for some unknown reason I must double-click on a terminal window because the new line does not show up for some reason. Solved, thank you!
    – user1527118
    Jan 14, 2013 at 20:32
0

Yes. If you're using Bash or a similar shell, type:

./your_script.py &
3
  • Tried that from the terminal but it does not work.
    – user1527118
    Jan 14, 2013 at 20:04
  • What OS and shell are you using?
    – Ivan Yurchenko
    Jan 14, 2013 at 20:05
  • Trisquel GNU/Linux with dash. In Terminal I am using bash, while in scripts dash. Either of these does not work. The command I am trying to execute is /usr/share/screenlets/CircleClock/CircleClockScreenlet.py which is a part of a program called Screenlets (also available in Ubuntu).
    – user1527118
    Jan 14, 2013 at 20:13

You must log in to answer this question.