Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 getting a script into the background
#1
i have done this, before, in C. i'd like to have my script run itself in the background, with the foreground exiting back to the shell. would it be good enough to just have a copy of itself run through the multiprocessing module and have the parent just exit? should i used an intermediary child process? any general suggestions? any pre-written code?

another aspect of this is that ALL other processes for that user will be terminated soon. this could lead to strange effects Python might not be prepared to handle.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
I'm guessing that you can't auto run in background since the interpreter will run in foreground.
Only thing I can think of that comes close is running from cron and starting in background
Quote
#3
the interpreter needs to be in the same process. multiprocessing would call os.fork which would duplicate the process into parent and child. the parent would exit and the child would continue to run. the shell would get SIGCHLD and prompt for the next command. i'm just wondering if there is a more direct way to do that, like something.enter_process_background().
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)