You are not logged in.

#1 2008-11-10 17:30:54

AsA
Member
From: Milan - Italy
Registered: 2008-10-05
Posts: 40

Start python applications in background

Hi everyone,
I was trying to launch sonata with autostart.sh in openbox, when I realized that every python application (and sonata among them) "dies" when the shell is closed (autostart.sh is a bash script), even if '&' is used to run the command in background.

So, is there a workaround to have python application backgrounded when launched from terminals or bash scripts?

Thanks!


WINDOS - Windos Is Not a Decent Operating System

Help me improve my english!
If you notice bad grammar in my posts, please correct me! Thanks!

Offline

#2 2008-11-10 18:22:32

ghostHack
Member
From: Bristol UK
Registered: 2008-02-29
Posts: 261

Re: Start python applications in background

try subshelling it, the entry for sonata in my autostart.sh is

( sleep 2 && sonata --hidden) &

Offline

#3 2008-11-10 20:27:44

AsA
Member
From: Milan - Italy
Registered: 2008-10-05
Posts: 40

Re: Start python applications in background

Ok, now it's solved, sonata could be run simply with "sonata &", the problem I had was caused by an error I had done previously.

But still remains a doubt. Why running in a terminal emulator "(sonata &)" makes sonata backgrounded (can close the terminal), while typing "sonata &" (without brackets) simply don't?.
I didn't know of any magical power of round brackets. hmm

Last edited by AsA (2008-11-10 20:28:21)


WINDOS - Windos Is Not a Decent Operating System

Help me improve my english!
If you notice bad grammar in my posts, please correct me! Thanks!

Offline

#4 2008-11-11 09:45:50

ddaedalus
Member
Registered: 2008-01-14
Posts: 54

Re: Start python applications in background

Most X apps should fork off the shell, like gvim for firefox.
When the shell is closed it terminates all jobs by sending SIGHUP. You can use nohup <programname> to launch a program you want to live after closing the shell.

Offline

#5 2008-11-11 10:02:25

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: Start python applications in background

AsA wrote:

Ok, now it's solved, sonata could be run simply with "sonata &", the problem I had was caused by an error I had done previously.

But still remains a doubt. Why running in a terminal emulator "(sonata &)" makes sonata backgrounded (can close the terminal), while typing "sonata &" (without brackets) simply don't?.
I didn't know of any magical power of round brackets. hmm

hmm... does sonata& and sonata & react differently?


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

#6 2008-11-11 14:13:13

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: Start python applications in background

man nohup

and (in bash)

help disown

The difference between these escapes me right now. Except it's clear they're called differently: you "nohup COMMAND &" to start the command as backgrounded and not-to-be-killed when the shell closes. You "disown -h %1" to say that (already backgrounded or interrupted) job %1 should not be killed when the shell closes. I'm not sure if there's any difference in functionality beyond these calling differences. Anyone able to clarify?

Offline

Board footer

Powered by FluxBB