![]() ![]() in the background in my Ubuntu machine (12.04) like this - nohup python. This almost does what I want, except that it still redirects output to nohup.out instead of /dev/null, even though I'm explicitly redirecting stdout and stderr to /dev/null in the command I'm running. How to Use a Bash Script to Run Your Python Scripts process run python sript. Subprocess.call('nohup %s &> /dev/null &' % ' '.join(sys.argv), shell=True) ![]() I thought I'd save myself some typing in the long run by putting a Python script in my $PATH that contains: import subprocess It also keeps the program from quitting if I close the terminal. Notably, it effectively redirected stderr and stdout to /dev/null. What I was doing before I wrote the script was just typing nohup &> /dev/null & 3 Answers Sorted by: 6 Sorry this comes late, but the way to run a python script within a particular environment is to write a shell script like this: /bin/bash source activate myenv & python myscript.py and have that wrapper script as your service instead of the python script itself. ![]() I have a short utility script I use to save typing when I want to call a GUI program from a terminal, make sure it keeps running even after the terminal closes, and keep it from spewing output to the terminal. Sorry, that's the shortest specific title I could come up with. How do I detach a process from Terminal, entirely Ask Question Asked 14 years, 3 months ago Modified 3 months ago Viewed 507k times 385 I use Tilda (drop-down terminal) on Ubuntu as my 'command central' - pretty much the way others might use GNOME Do, Quicksilver or Launchy. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |