LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 04-18-2007, 05:45 AM   #1
danraider
Member
 
Registered: Feb 2004
Distribution: Slackware 12 - dropline Gnome
Posts: 43

Rep: Reputation: 15
What process is reading xorg.conf? and when?


hi!

I have a laptop with suse 10.2 on it.
At work it's connected to a docking station with 2 external monitors.

I have 2 xorg.conf files I switch inbetween.

up until now I have been using a script to ckeck if the lid is open, if the lid is open I use the single xorg file, if the lid is closed the laptop is connected to the docking station and I use the dual-xorg.conf file.

I boot in to runlevel 5.

The problem is that recently I have been unplugging and re-plugging the laptop quite a bit from the docking station.

I want to add my script to the process that call the xorg.conf file so that I can just ctrl+alt+backspace to restart the xserver and in the restart process switch to the correct xorg.conf file.

The script is very simple but does the job:
Code:
if [ "`cat /proc/acpi/button/lid/LID/state`" = "state:      closed" ];
then
        # Dual screen setup
        `cp /etc/X11/xorg.conf.dualscreen /etc/X11/xorg.conf`
fi

if [ "`cat /proc/acpi/button/lid/LID/state`" = "state:      open" ];
then
        # Laptop mode
        `cp /etc/X11/xorg.conf.laptop /etc/X11/xorg.conf`
fi
My big question is where can I call this script from so that it will be run when I do ctrl+alt+backspace?

I also intend to remove it from my startup scripts so that it is only referenced from one location, from the line before the line where xorg.conf is first called.

If anyone have any suggestions please tell me!

regards,
 
Old 04-18-2007, 11:06 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
I would suggest sticking it into /etc/rc.d/rc5.d in order for it to be executed when the system starts the X system when going to init level 5.
However, that said, I am NOT 100% certain this is the right place exactly, for your desire to have it read each time the CTRL-ALT-BACKSPACE is pressed. For CTRL-ALT-DELETE, perhaps YES, but again not sure for CTRL-ALT-BACKSPACE.
If possible, check into the scripts in /etc/X11/xinit/ and try to determine what exactly is the course of events to which that key-stroke is mapped. For example, it might be better to integrate your code into the file /etc/X11/xinit/xinitrc, which I think is the very script which starts X.
 
Old 04-19-2007, 09:39 AM   #3
danraider
Member
 
Registered: Feb 2004
Distribution: Slackware 12 - dropline Gnome
Posts: 43

Original Poster
Rep: Reputation: 15
rc5.d is where I currently have my script, works fine but I need to reboot.

I have tried to add it to /etc/X11/xinit/xinitrc without avail.

I have been around most files I can think of, none actually call xorg.conf. (as far as I've seen)...

thanks,
 
Old 04-19-2007, 04:25 PM   #4
tytower
Member
 
Registered: Jun 2006
Location: Oz
Distribution: Mandriva 10.0,10.1,10.2,2006,Mepis 6.0,Opensuse10.2,Puppy 2.14
Posts: 250

Rep: Reputation: 30
Yast CC ->security and users-> local security
opens a box to set Alt cntrl delete actions also but I don't think this is what you need . Might be useful to know if it keeps getting reset after you change it
 
Old 04-19-2007, 08:59 PM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Danraider, you say it works fine in rc5.d, but you need to reboot for it to take effect..
What if you were to simply telinit to level 1, and then log in again and telinit back to level 5 ? I'm not really sure this would save you any time or effort, but if it's avoiding rebooting you want, it will do that atleast.
All processes are killed when telinit'ing to level one, so to do this can't easily be made a one-shot deal.. And (at least on my system) telinit'ing to any other level other than one, isn't suffucient to cause X to restart.
If there's another method of killing X and restarting it from scratch, while NOT changing to level 1, I'd be keen on knowing what it is, 'cause it may be your answer; I simply don't have enough knowledge/experience yet to figure it out
 
Old 04-20-2007, 10:58 AM   #6
statguy
Member
 
Registered: Sep 2004
Location: Ontario, Canada
Distribution: Slackware 14.2, current
Posts: 416

Rep: Reputation: 36
To repeat what others have said, I'm not really sure if this is what you want but ...

I have used the profile management facility in SuSE. You can configure it to include X settings as part of what is profile specific. You can change profiles while logged in without rebooting.
 
Old 04-21-2007, 05:10 AM   #7
danraider
Member
 
Registered: Feb 2004
Distribution: Slackware 12 - dropline Gnome
Posts: 43

Original Poster
Rep: Reputation: 15
Some interesting suggestions,

telinit to level 1 and then back again would do the trick but then that's almost like rebooting anyway...

Why I don't want to reboot is because I run some apps in the background that aren't killed when I restart X. These guys take some time to close and initialize and they could be processing jobs...

statguy, I have seen the profile management facility but I'm not sure how to work it. I have recently migrated from slackware so the thing is I'm much more comfortable in an environment where all settings are governed in files rather than GUI's.

That said, could someone please point me into the right direction regarding setting up different profiles?

thanks!
 
Old 04-21-2007, 08:21 AM   #8
statguy
Member
 
Registered: Sep 2004
Location: Ontario, Canada
Distribution: Slackware 14.2, current
Posts: 416

Rep: Reputation: 36
Quote:
Originally Posted by danraider
Some interesting suggestions,

statguy, I have seen the profile management facility but I'm not sure how to work it. I have recently migrated from slackware so the thing is I'm much more comfortable in an environment where all settings are governed in files rather than GUI's.

That said, could someone please point me into the right direction regarding setting up different profiles?

thanks!
You set it up in YaST. I'm not posting from my SuSE machine at the moment and I haven't used this on version 10.2 (I'm waiting for a new laptop), only 9.2. This is from memory.

In the configuration screens you can set which services/systems can be changed by profile management. It includes such things as network (useful for me since I connect to multiple wired networks with static IP addresses), printers etc. IIRC, you can even include custom scripts of your own that are run when you change profiles. One of the services that can be included is X. You could opt for all settings or selected settings. Just explore the options before you deploy it. It is also described in the SuSE help system.

I use (and love) slackware as well on another computer. Probably one of the hardest things for a slacker in using SuSE is that it is usually best to use the admin tools you are provided rather than edit the individual config files. There are exceptions, of course.

If I get a chance over the weekend, I'll take a closer look at the profile management in SuSE to see if I forgot anything important.
 
Old 04-21-2007, 08:57 AM   #9
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Here's something to try and/or keep in mind incase it's useful or maybe even does the job:
Code:
killall -HUP X
It will kill all X processes and restart X. Again as before, I'm not certain it will run your script though, but I would *think* that if your script were pasted INTO the beginning of rc5.d, it would swap the xorg.conf file, then continue on to run X afresh.
 
Old 04-23-2007, 03:59 AM   #10
danraider
Member
 
Registered: Feb 2004
Distribution: Slackware 12 - dropline Gnome
Posts: 43

Original Poster
Rep: Reputation: 15
I have had a look at the profiles.
I created myself a second profile, activated it, edited the setting files and then changed back to my other profile. For some reason the files did not change over when I changed profile. I did add these files and services to the list of files monitored by the profile manager.

When swapping profiles I'm asked to save or discard changes, however the system does not detect any changes. Suse being suse might want me to set up my screen in the gui, problem is that the gui can't set up my screens, xorg must be manually edited.

In regards to killing X, when X is killed -HUP only X is restarted, nothing is calling the runlevel scripts again, if that would have been the case it would have all been working already
This approach is a bit tedious as not even the regular starting-up-X scripts are run. I'm starting to think I might have to go to the source in order to succeed with this approach.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading inetd.conf Echo Kilo Linux - General 6 03-17-2005 09:54 PM
reading values for a background process shadowman21i Programming 1 12-22-2004 06:47 AM
Xorg Hard Crashes and corrupts xorg.conf Advocator Linux - General 0 07-15-2004 01:41 PM
.conf Reading gamehack Programming 1 04-04-2004 12:19 PM
Re-reading Smb.conf magyartoth Linux - Networking 2 06-25-2002 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration