LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 01-24-2006, 11:32 AM   #1
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302
Blog Entries: 4

Rep: Reputation: Disabled
Script to force resolution/hertz range


Hey all. I'm trying to create a script that will be placed into the startup for RH ES 4 so that it runs at each bootup. The script will force resolution and hertz because of what's attached. These are headless boxes all running ES 4 that are attached via keyboard/video/mouse dongles going to Avocent switches. The dongles need to ensure that the OS speaks a specific res and hertz because of the ddc information and what's supported within the firmware of the dongles. The range is 60-75 and 1024x768 res. I know I'm going to have to pipe the cat /etc/X11/Xorg.conf to something, but I get lost after I successfully grep the monitor section. I'm guessing some sort of sed statement would do the trick since I know it will always have the exact syntax, but perhaps someone has a quick and dirty fix for this?


Thanks ahead of time for putting any thought into this one.


Regards,
LoadedMind
 
Old 01-24-2006, 11:43 AM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Why don't you just permanently put it in Xorg.conf? It's not likely to change very often, is it?
 
Old 01-24-2006, 12:30 PM   #3
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
The script would be to give out to customers that probably don't know too much about linux. That would be ideal, but now I'm trusting my customers to do this process which, in the past, they haven't been extremely detail-oriented. Trying to find the best way to ensure there are no errors on the user-side. Know what I mean?
 
Old 01-24-2006, 12:38 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Ah, now I understand completely. You could do something like:
Code:
TMP=`mktemp`
cp /etc/X11/xorg.conf $TMP
cat $TMP | sed 's/^[ \t]HorizSync.*$/HorizSync 60-75/' | sed 's/^[ \t]*Modes.*$/Modes "1024x768"/' > /etc/X11/xorg.conf
rm $TMP
No guarantees that will work, I just wrote it off the cuff.
 
Old 01-24-2006, 02:45 PM   #5
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
Awesome! Thanks!
 
Old 01-24-2006, 04:38 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
No problem. Let me know how it works out and if you don't mind, display the finished work here for anyone who has the same sort of problem.
 
Old 03-07-2006, 04:32 PM   #7
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 302

Original Poster
Blog Entries: 4

Rep: Reputation: Disabled
Ok, I've taken that script and modified it a bunch after doing some research. This is what I've come up with so far:

----------------------------------------Begin Paste--------------------------------------------

#!/bin/bash
case "$1" in
install)
echo "Backing up and modifying /etc/X11/xorg.conf"
if test -f /etc/X11/xorg.conf
then
cp /etc/X11/xorg.conf /etc/X11/xorg-avocent.conf
XCONF="/etc/X11/xorg.conf"
cat $XCONF | sed 's/^[ \t]HorizSync.*$/HorizSync 60-75/'
| sed 's/^[ \t]*Modes.*$/Modes "1024x768"/' > /etc/X11/xorg.conf
echo blahh >> $XCONF
echo "Install Complete!"
exit
else
echo "you are not running xorg"
exit
fi
exit
;;
uninstall)
echo "Cleaning up..."
cp /etc/X11/xorg-avocent.conf /etc/X11/xorg.conf
echo "Uninstall Complete!"
exit
;;
*) echo "#########################################"
echo "# Utility to change resolution in linux #"
echo "# Please send bug reports to my ass #"
echo "#########################################"
echo ""
echo "Usage: $0 [install | uninstall]"
echo ""
exit
;;
esac
---------------------------------End Paste-----------------------------------

I realize this is pretty dirty and archaic, but I think it might actually get the job done. Thoughts? Comments?
 
  


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
command or shell script to print line range from file minil Programming 3 12-28-2005 08:05 AM
Changing resolution and hertz redhat ralide Linux - Hardware 5 06-29-2005 01:28 PM
60 hertz screen, dunno how to change it to 85. Vuurvos Fedora 17 02-05-2005 03:32 PM
Hertz problems! rudqwist Linux - Newbie 7 01-24-2005 11:17 PM
Monitor Resolution of Resfresh seems out of range on new install manderino Mandriva 29 12-06-2004 11:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 11:18 PM.

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