I want to run python ~/program/proxy.py in a terminal when I boot up. And then hide this terminal window (because it is just a proxy program, and I don't want to see the debug info). So how can I get it to work?

  • 1
    As @andcoz notes, there is something wrong here. Running a python program as part of the boot process would not generate a terminal window in the first place. In fact even if it was part of the login/session script it shouldn't need a terminal window. Can you edit your question to show how exactly you have configured this NOW so it's more clear what needs to be changed to accomplish what you are after?
    – Caleb
    Aug 1, 2011 at 9:38

5 Answers 5


IMHO, the optimal solution is to run that proxy as system daemon.

This tutorial from Novel should teach you core concepts. Unluckily it is a little bit SuSE-centric, on other distributions the details could be slightly different. Use it as starting point.

P.S. There is something strange in your question, a service started at boot doesn't have a terminal window. A program started when you log on can have a terminal window. Perhaps do you have auto-login feature enabled, so you are confusing boot process with log-in process.


A more rough approach is to write a simple script that wraps your program and detaches it from its terminal. Something like:


nohup python ~/program/proxy.py > ~/.proxy.log 2>&1 &

Then you can put it in your log-in auto-startup sequence (as you, probably, already done).

  • The posix nohup does not call setsid() (some implementations do) you've only isolated the signal, it's still in the same process group
    – symcbean
    Aug 3, 2011 at 15:56
  • Yes, @symcbean, you are right. Obviously, I prefer my other answer. This answer is only a quick and rough alternative. It also do not take in account that if you log out and then (re)log in, you'll run two instances of the proxy.
    – andcoz
    Aug 3, 2011 at 23:07
  • 1
    agreed writing a daemon would be a better approach, but 'echo /usr/bin/python ~/program/proxy.py | at now' is a quick fix.
    – symcbean
    Aug 8, 2011 at 20:04

Using tmux you can start a detached process, which is effectively "hidden", and attach it to check its status, as and when you like. If you start it from a terminal, you can even close that terminal session, and subsequently attach to your tmux python process from another terminal ...

This example uses watch as the command to run, but just substitute your python command... It starts the tmux session in an already deteched state.

tmux new -d 'watch -n 1 -d date'

To view the current state of the "hidden" (detached) session, just type tmux attach in a Terminal window...

You can also use screen, but I believe tmux may be the better choice, based on the comments in this Unix-&-Linux answer...


To provide you a literal answer to your question, you could use a program such as AllTray*. You could then pass it a command to start up a terminal, and pass a command to that terminal to run your program. If you tell AllTray to hide the terminal, then it will be embedded in the system tray, ready for you to pull up if you need to view the output.

However, I would recommend you go with andcoz's answer and run this program as a system dæmon. Have the output go to a log file. The only way that wouldn't work is if it were an interactive program, but by the sounds of it, we're not talking about an interactive program.

* Disclaimer: I am the maintainer of AllTray


Depending on how early in the boot you want this to run, you may want to use cron @reboot.

(You may need to play with environmental variables.)

Then wrap it in a detached terminal.

tmux new -d '/path/to/python /full/path/program/proxy.py'
# or #
screen -d -m '/path/to/python /full/path/program/proxy.py'

Effectively these are backgrounded to synthetic terminals.

This is commonly done for "mickey mouse" server process such as "sinatra" or "minecraft" or even headless "folding at home".

For neatness/control, you may want to use a shell script to wrap up the launch and invoke that from cron.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .