LinHES Forums
http://forum.linhes.org/

Restarting GDM from fluxbox key binding [SOLVED]
http://forum.linhes.org/viewtopic.php?f=5&t=12216
Page 1 of 1

Author:  ed3120 [ Wed Oct 18, 2006 9:15 pm ]
Post subject:  Restarting GDM from fluxbox key binding [SOLVED]

As user mythtv, I can run the following command and successfully restart GDM:
Quote:
sudo /etc/init.d/gdm restart


If I bind this action to a key in fluxbox (F8 in my example)

Quote:
/etc/X11/fluxbox/keys

None F8 :ExecCommand sudo /etc/init.d/gdm restart


...and I execute the F8 key, GDM stops but never comes back. My screen goes crazy until I restart GDM from a command shell (either as user mythtv or as root)

What is the difference between executing the command as user mythtv via command line versus executing it as user mythtv via a fluxbox key?

Author:  alien [ Thu Oct 19, 2006 12:01 am ]
Post subject: 

Well, a restart is a stop followed by a start. The stop killed gdm, including fluxbox and the gdm restart command since it was executied within fluxbox.... before it could do the start.

You might try
Code:
sudo /etc/init.d/gdm restart &
to put it in the background, or possibly:
Code:
sudo /etc/init.d/gdm restart > /dev/null 2>&1 &
I've never tried it and have never understood the parent/child process rules, but it might work.

Allen

Author:  ed3120 [ Thu Oct 19, 2006 8:16 am ]
Post subject: 

Excellent point...I wasn't thinking of it that way.

Could you explain what the:
Code:
> /dev/null 2>&1 &


part of your process is for? Thanks!!

Author:  alien [ Thu Oct 19, 2006 9:41 am ]
Post subject: 

The "> /dev/null" redirects the standard output to /dev/null. The "2>&1" sends standard error to the same place. This is because gdm restart prints out some messages and I'm not sure what happens if it tries to send output to a non-existent screen. The may not be necessary.

The "&" puts the process in the background and returns control. Try "(sleep 10;ls)&" from the command line and you will see what happens. The command prompt comes back immediately, but the ls output appears 10s later.

Allen

Author:  mjl [ Thu Oct 19, 2006 10:09 am ]
Post subject: 

Hi,

I would suggest to put your restart command into a script for root to run and then call the script from the key

something simular to:
/usr/local/bin/restart-gdm

#!/bin/sh
#
sudo /etc/init.d/gdm restart &

Then when you activate the magic key the seperate script will run regardless of what the gdm is doing.
ExecCommand sudo /usr/local/bin/restart-gdm

Mike

Author:  ed3120 [ Thu Oct 26, 2006 9:52 am ]
Post subject: 

This is the line that solved what I was trying to accomplish....

Quote:
sudo /etc/init.d/gdm restart > /dev/null 2>&1 &


Thanks!!

Author:  myth19kirt [ Thu Jan 03, 2008 2:58 pm ]
Post subject:  Launch FireFox with keypess

Thanks guys. I added to my keyboard shortcuts within /etc/X11/fluxbox/keys
Code:
Mod1 i :ExecCommand sudo firefox&

So now alt i will now start firefox on my mythbox and I can look at the sports scores while I DVR timeshift the games.
My homepage will be http://localhost/RRD/daily webpage for my mythbox. I hope to add a shutdown key with:
Code:
Mod1 4 :ExecCommand sudo shutdown -h now

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/