running a python script in the background

From: Arun (arun.sivakumaran_at_gmail.com)
Date: 10/30/04


Date: 29 Oct 2004 20:23:47 -0700

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 the system() function to run the simulator) over a list of
config files. I want the python script to itself run as well as start
the simulations totally in the background (the simulations run for a
day or two, so basically I want to start them in background and log
off).

The structure of script is somewhat like this:
--------------------------------

Create the config files

Loop through the list of config files:
     system("simulator configfile");

---------------------------------

Now if I start the script in the background with "script.py &", it
doesn't work. I figure the reason is the system() call spawns the
simulator in the foreground.

If I change the system call to system("simulator configfile &"), then
the script will spawn off the simulator with the config files all at
once.

Is there a way I can make this all run in the background, while at the
same time ensuring that only one instance of the simulator is running?

Thanks!,
Arun



Relevant Pages

  • Re: Newb ??
    ... > Now, I put the script you gave into an editor and ran it, (I use Ubuntu ... > Perhaps you can point out to me how I should go about debugging. ... honest human, the posted algorithm ... the simulator wouldn't have finished). ...
    (comp.lang.python)
  • Running multiple instances of tcl_main
    ... simulator that reads a tcl script & use it to send messages to my ... switch & receives messages from it so that I can test my switch. ...
    (comp.lang.tcl)
  • Re: Running multiple instances of tcl_main
    ... simulator that reads a tcl script & use it to send messages to my ... switch & receives messages from it so that I can test my switch. ...
    (comp.lang.tcl)
  • Re: DTS SQL 2000 Global Variable initialization problem - please h
    ... Many people put "settings" in them at design time that control execution. ... when I suggested putting an "init" script in the package to set ... will be cleared, others will be set from config files, database lookups, etc. ... Do you have an example of an init script I can use for initializing ...
    (microsoft.public.sqlserver.dts)
  • Re: Make constant backup of various config files?
    ... backup various config files into a zip/tar ... I already think I have a script in my head on how to do it already, ... How about using tar to capture the content of the files you ...
    (comp.os.linux.misc)