473,320 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Running python automatically in the background

hi all,

i'm trying to figure out if there is some easy way to run a python
script in the background _without_ specifying "&" in a linux
enivornment.

script.py &

vs

script.py

is there an easy way to do this?

been looking around but couldn't find any docs to support a
possibility.

thanks!

- al
Jul 18 '05 #1
3 1425
On 27 Jan 2004 17:29:53 -0800, Alfred wrote:
i'm trying to figure out if there is some easy way to run a python
script in the background _without_ specifying "&" in a linux
enivornment.

script.py &
That's how you tell any POSIX-compatible shell (like bash) to execute a
command as a background job. Why is that not acceptable?
been looking around but couldn't find any docs to support a
possibility.


Perhaps if you explain what it is you're trying to achieve, we can offer
a better solution.

--
\ "We used to laugh at Grandpa when he'd head off and go fishing. |
`\ But we wouldn't be laughing that evening when he'd come back |
_o__) with some whore he picked up in town." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>
Jul 18 '05 #2
In article <sl*******************************@rose.localdomai n.fake>,
Ben Finney <bi****************@and-benfinney-does-too.id.au> wrote:
On 27 Jan 2004 17:29:53 -0800, Alfred wrote:
i'm trying to figure out if there is some easy way to run a python
script in the background _without_ specifying "&" in a linux
enivornment.

script.py &


That's how you tell any POSIX-compatible shell (like bash) to execute a
command as a background job. Why is that not acceptable?
been looking around but couldn't find any docs to support a
possibility.


Perhaps if you explain what it is you're trying to achieve, we can offer
a better solution.

Jul 18 '05 #3
On Tue, 27 Jan 2004 17:29:53 -0800, Alfred wrote:
hi all,

i'm trying to figure out if there is some easy way to run a python
script in the background _without_ specifying "&" in a linux
enivornment.

script.py &

vs

script.py

is there an easy way to do this?

been looking around but couldn't find any docs to support a
possibility.

thanks!

- al

I forget where I first found this snippet, but it's probably what you want.

PID= os.fork()
if PID != 0: sys.exit()

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: kbass | last post by:
In different articles that I have read, persons have constantly eluded to the productivity gains of Python. One person stated that Python's productivity gain was 5 to 10 times over Java in some in...
3
by: David MacQuigg | last post by:
I am writing a chapter for teaching OOP in Python. This chapter is intended as a brief introduction to replace the more complete discussion in Learning Python, 2nd ed, pp. 295-390. I need to...
7
by: Arun | last post by:
Hi, This is a scripting question, but since I am writing the script in python I am posting this question here: I have a python script that runs a simulator (that was written in c++, so I use...
17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
1
by: Mathias Dahl | last post by:
I am creating a small app called PyQe (http://klibb.com/cgi-bin/wiki.pl/PyQe) to launch commands and programs quickly. I works more or less as I want it now and I have managed to make my window...
13
by: wattersmt | last post by:
Hello, I am trying to write a python cgi that calls a script over ssh, the problem is the script takes a very long time to execute so Apache makes the CGI time out and I never see any output. ...
8
by: Ravi | last post by:
Hi to all, There is a start button in my page. if user clicks on that then a php program should start and should listen on a particular port. and also user should able to do other tasks on...
5
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
6
by: Guillermo | last post by:
Hi, I need a script to keep running in the background after it's loaded some data. It will make this data available to the main program in the form of a dictionary, but I don't want to reload...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.