Turn off the linux console display

Posted in centos, computers, howto, linux, operating systems, software, troubleshooting on July 1st, 2010 by kerneljack

I needed a way to turn off the display on an old netbook that I am using as a low-powered server. I installed CentOS 5.5 on the netbook and set the ‘inittab’ to boot into console mode by default however I did not know how to turn the display off completely when in console mode. I wanted to do this for various reasons; saving power and reducing the heat generated were my primary concerns.

I was thinking of using ‘setterm’ for this, but I decided to google this first and found the perfect solution in the Arch forums. Just in case that link stops working I’m going to include the script below, hopefully it will be helpful to other people.

#!/bin/bash

###################################################
# Check if X is running or not, turn off monitor, #
# wait for a key press and turn it on again.      #
###################################################

grep_result_file=$PWD'/x_running'

# Check if X is running.
ps -e | grep -e "\bX\b" > $grep_result_file
ps -e | grep -e "\bxorg\b" >> $grep_result_file
ps -e | grep -e "\bxserver\b" >> $grep_result_file

## If you want to check result file, uncomment following lines.
#echo "===== $grep_result_file - begin ====="
#cat $grep_result_file
#echo "===== $grep_result_file -  end  ====="

if [ ! -s $grep_result_file ] || [[ $(tty) =~ tty ]] || [[ $(tty) =~ vc ]]; then
    echo 'Detected X not runnig or you are at console...'
    if [ $UID -ne 0 ]; then
        echo 'You need super user privileges to run this script at console.'
        echo 'Rerun as super user or start X and run from a terminal.'
        exit 0
    fi
    turn_off='vbetool dpms off'
    turn_on='vbetool dpms on'
else
    echo 'Detected X running...'
    turn_off='xset dpms force off'
fi

echo 'Turning off monitor...'
$turn_off

echo 'Waiting for a key press...'
read -n1 -s

echo 'Turning on monitor...'
$turn_on

rm $grep_result_file

echo 'Finished: monitor_off'
kill -9 $PPID
Tags:

Fix for strange white borders with Compiz Fusion on Ubuntu

Posted in beryl, compiz, fusion, hardware, linux, software, troubleshooting, ubuntu on August 30th, 2007 by kerneljack

I’ve just installed Compiz Fusion on my 3-year old ASUS laptop which is running Ubuntu Feisty. I’m quite pleased at how stable it is. I tried Beryl a few months ago and it was not usable at all on the same hardware.

I did run into one problem, though and I couldn’t find any solution to it on either the Ubuntu Forums or anywhere else on the net. My top Gnome panel had a strange white bar under it and all my context menus had white borders. Maybe my google-fu wasn’t very good yesterday, but the only solution that I managed to find after about an hour was this on a Gentoo forum:

This is a known issue. Go to ccsm->Window Decorations and add the string !dock to the value Shadow Windows. I had to enter 2 !dock. First disabled shadows of the context menus and the tool tips, the second stops shadows for the gnome-panel.

I’m just putting this here in case it helps someone with a similar problem.

Technorati Tags:

Powered by ScribeFire.