bg and fg

Chris Gonnerman chris.gonnerman at
Sun Nov 4 15:44:07 CET 2001

----- Original Message ----- 
From: "Stefan Antoni" <sasoft at>

> - i am using linux
> - i got a script that takes the time.ctime string and
>   compares it with a set time. if the time is the same
>   as the set time, it will do something.
> - the script is a non-gui application (see bottom of this mail)
> question:
> 1. how can i move my process in the background after i
>    started it (like: myscript & -> but automatically).

if os.fork():

... is the basic code (full daemon mode takes a bit more work).

> 2. how do i move it back in the foreground when the
>    action for the set time is performed?

You can't.  The shell does it by keeping a "grip" on the process,
and so it can return it to the foreground when told to.  AFAIK you
can't tell the shell to do this programmatically.

More information about the Python-list mailing list