Re: howto serialize tasks in .xsession
On Sun, 2004-02-29 at 02:09, Gregory Seidman wrote: > On Sat, Feb 28, 2004 at 03:50:17PM -0800, Nano Nano wrote: > } I run a hybrid desktop: gnome-control-center is installed, but not > } metacity. Fluxbox is my WM; but I remove gnome-session as a Session > } Manager so I have No Session Manager. Here is my .xsession: > } > } #!/bin/sh > } ARGS="--hide-menubar --window-with-profile=Default" > } #gnome-control-center > } gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon > --oaf-ior-fd=21 & > } xscreensaver -nosplash & > } kdeinit & > ( sleep 5 > } gbuffy & > } #xmms & > } gnome-terminal $ARGS --geometry=80x25+1+22 & > } gnome-terminal $ARGS --geometry=95x25+582+22 & > } gnome-terminal $ARGS --geometry=80x40+1+418 & > } gnome-terminal $ARGS --geometry=95x40+582+418 & > ) > } exec fluxbox > [...] > } The problem is if gbuffy or gnome-terminal starts before > } gnome-settings-daemon, themes and various gnome-ish things are broken. > } It's a classic race conditions. > } > } How can I serialize the tasks? Remember, none can block. > } gnome-settings-daemon doesn't return. > > Note the two added lines above. This is the simplest way to deal with > that sort of thing. Adjust the length of the sleep to taste. A better > way is to use a spinlock wrapped around lsof or netstat right after the > gnome-settings-daemon call (note that calling it without any arguments > works at least as well): > > #... > gnome-settings-daemon & > GSDPID=$! > while lsof -u$USER | awk 'BEGIN { found = 0; } > ($2 == "'$GSDPID'") && ($8 ~ /orbit-'$USER'/) { found = 1; next } > END { exit found }' > do > sleep 1 > done > sleep 1 > #... > > This will run lsof once a second until gnome-settings-daemon has set up > its unix socket, then sleep one extra second for safety, then proceed. > Note that it uses the pid gnome-settings-daemon started with, so other > instances of the daemon will be ignored. Thanks... sometimes it pays to not go the ugly hack route. Nicely done. -- [EMAIL PROTECTED] REMEMBER ED CURRY! http://www.iwethey.org/ed_curry Novell's Directory Services is a competitive product to Microsoft's Active Directory in much the same way that the Saturn V is a competitive product to those dinky little model rockets that kids light off down at the playfield. -- Thane Walkup signature.asc Description: This is a digitally signed message part
Re: howto serialize tasks in .xsession
On Sun, Feb 29, 2004 at 02:09:17AM -0500, Gregory Seidman wrote: > ... A better > way is to use a spinlock wrapped around lsof or netstat right after the > gnome-settings-daemon call (note that calling it without any arguments > works at least as well): > > #... > gnome-settings-daemon & > GSDPID=$! > while lsof -u$USER | awk 'BEGIN { found = 0; } > ($2 == "'$GSDPID'") && ($8 ~ /orbit-'$USER'/) { found = 1; next } > END { exit found }' > do > sleep 1 > done > sleep 1 > #... > This works. Thanks! I'll grok it later. I never really understood awk (still don't); it's nice to have a useful example. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto serialize tasks in .xsession
On Sat, Feb 28, 2004 at 03:50:17PM -0800, Nano Nano wrote: } I run a hybrid desktop: gnome-control-center is installed, but not } metacity. Fluxbox is my WM; but I remove gnome-session as a Session } Manager so I have No Session Manager. Here is my .xsession: } } #!/bin/sh } ARGS="--hide-menubar --window-with-profile=Default" } #gnome-control-center } gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon --oaf-ior-fd=21 & } xscreensaver -nosplash & } kdeinit & ( sleep 5 } gbuffy & } #xmms & } gnome-terminal $ARGS --geometry=80x25+1+22 & } gnome-terminal $ARGS --geometry=95x25+582+22 & } gnome-terminal $ARGS --geometry=80x40+1+418 & } gnome-terminal $ARGS --geometry=95x40+582+418 & ) } exec fluxbox [...] } The problem is if gbuffy or gnome-terminal starts before } gnome-settings-daemon, themes and various gnome-ish things are broken. } It's a classic race conditions. } } How can I serialize the tasks? Remember, none can block. } gnome-settings-daemon doesn't return. Note the two added lines above. This is the simplest way to deal with that sort of thing. Adjust the length of the sleep to taste. A better way is to use a spinlock wrapped around lsof or netstat right after the gnome-settings-daemon call (note that calling it without any arguments works at least as well): #... gnome-settings-daemon & GSDPID=$! while lsof -u$USER | awk 'BEGIN { found = 0; } ($2 == "'$GSDPID'") && ($8 ~ /orbit-'$USER'/) { found = 1; next } END { exit found }' do sleep 1 done sleep 1 #... This will run lsof once a second until gnome-settings-daemon has set up its unix socket, then sleep one extra second for safety, then proceed. Note that it uses the pid gnome-settings-daemon started with, so other instances of the daemon will be ignored. --Greg -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto serialize tasks in .xsession
On Sat, Feb 28, 2004 at 11:55:44PM -0500, Greg Folkert wrote: > On Sat, 2004-02-28 at 18:50, Nano Nano wrote: > > I run a hybrid desktop: gnome-control-center is installed, but not > > metacity. Fluxbox is my WM; but I remove gnome-session as a Session > > Manager so I have No Session Manager. Here is my .xsession: > > > > #!/bin/sh > > ARGS="--hide-menubar --window-with-profile=Default" > > #gnome-control-center > > gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon > > --oaf-ior-fd=21 & > > xscreensaver -nosplash & > > kdeinit & > > gbuffy & > > #xmms & > > gnome-terminal $ARGS --geometry=80x25+1+22 & > > gnome-terminal $ARGS --geometry=95x25+582+22 & > > gnome-terminal $ARGS --geometry=80x40+1+418 & > > gnome-terminal $ARGS --geometry=95x40+582+418 & > > exec fluxbox > > > Break them out to a script with a sleep statement. That way it'll > non-block. Changes would be something like: Ug, what a gruesome hack, but it works. For what its worth, putting a blocking "sleep 1" right after the gnome-settings-daemon is enough time for it to init itself, because nothing else heavyweight has started yet. It'll probably fail periodically, sleeping always does. Even if you sleep 10 seconds, murphy's law says something's going to block it 10 seconds! (It always happens). The strange thing is gnome-settings-daemon spits out some debug output when its ready (apparently to stdout or stderr) but if you try to redirect them it doesn't. I thought I could block looking for that output, but it's tricky. Anyway, thanks. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: howto serialize tasks in .xsession
On Sat, 2004-02-28 at 18:50, Nano Nano wrote: > I run a hybrid desktop: gnome-control-center is installed, but not > metacity. Fluxbox is my WM; but I remove gnome-session as a Session > Manager so I have No Session Manager. Here is my .xsession: > > #!/bin/sh > ARGS="--hide-menubar --window-with-profile=Default" > #gnome-control-center > gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon --oaf-ior-fd=21 > & > xscreensaver -nosplash & > kdeinit & > gbuffy & > #xmms & > gnome-terminal $ARGS --geometry=80x25+1+22 & > gnome-terminal $ARGS --geometry=95x25+582+22 & > gnome-terminal $ARGS --geometry=80x40+1+418 & > gnome-terminal $ARGS --geometry=95x40+582+418 & > exec fluxbox > > As you can see, I used to run gnome-control-center synchronously, and > would double-click the Font applet, which would "wake up" the Gnome > settings and make themes and junk work. But I noticed what it runs is > gnome-settings-daemon so I just run that directly. > > The problem is I have to run gnome-settings-daemon, gbuffy, and > gnome-terminal all in the background, because only the final task (exec > fluxbox) can block. > > The problem is if gbuffy or gnome-terminal starts before > gnome-settings-daemon, themes and various gnome-ish things are broken. > It's a classic race conditions. > > How can I serialize the tasks? Remember, none can block. > gnome-settings-daemon doesn't return. Break them out to a script with a sleep statement. That way it'll non-block. Changes would be something like: ~/.xsession #!/bin/sh gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon --oaf-ior-fd=21 & xscreensaver -nosplash & kdeinit & gbuffy & ~/bin/xsession-wait & exec fluxbox ~/bin/xsession-wait #!/bin/sh ARGS="--hide-menubar --window-with-profile=Default" sleep 10 gbuffy & gnome-terminal $ARGS --geometry=80x25+1+22 & gnome-terminal $ARGS --geometry=95x25+582+22 & gnome-terminal $ARGS --geometry=80x40+1+418 & gnome-terminal $ARGS --geometry=95x40+582+418 & Should work, since the execution is backgrounded. Adjust delay as required. -- [EMAIL PROTECTED] REMEMBER ED CURRY! http://www.iwethey.org/ed_curry Novell's Directory Services is a competitive product to Microsoft's Active Directory in much the same way that the Saturn V is a competitive product to those dinky little model rockets that kids light off down at the playfield. -- Thane Walkup signature.asc Description: This is a digitally signed message part
howto serialize tasks in .xsession
I run a hybrid desktop: gnome-control-center is installed, but not metacity. Fluxbox is my WM; but I remove gnome-session as a Session Manager so I have No Session Manager. Here is my .xsession: #!/bin/sh ARGS="--hide-menubar --window-with-profile=Default" #gnome-control-center gnome-settings-daemon --oaf-activate-iid=OAFIID:GNOME_SettingsDaemon --oaf-ior-fd=21 & xscreensaver -nosplash & kdeinit & gbuffy & #xmms & gnome-terminal $ARGS --geometry=80x25+1+22 & gnome-terminal $ARGS --geometry=95x25+582+22 & gnome-terminal $ARGS --geometry=80x40+1+418 & gnome-terminal $ARGS --geometry=95x40+582+418 & exec fluxbox As you can see, I used to run gnome-control-center synchronously, and would double-click the Font applet, which would "wake up" the Gnome settings and make themes and junk work. But I noticed what it runs is gnome-settings-daemon so I just run that directly. The problem is I have to run gnome-settings-daemon, gbuffy, and gnome-terminal all in the background, because only the final task (exec fluxbox) can block. The problem is if gbuffy or gnome-terminal starts before gnome-settings-daemon, themes and various gnome-ish things are broken. It's a classic race conditions. How can I serialize the tasks? Remember, none can block. gnome-settings-daemon doesn't return. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]