This was a short bash script I wrote to help document some startup problems on a server.
The script was grabbing screen dumps from iDRAC during boot on a RHEL6 server, but it can be used on other distributions as well since the console command xwd is common.
#!/bin/bash
# Description:
# Grab screenshot of a specified X-window and wait X-seconds
# Use xwininfo to find the Window id to the window you are going to
# grab screenshots from.
xwininfo="0x4c0001a"
# filename for output
outfile="outfile-"
# seconds sleep between grabs
sleeping=2
padding="000" # put as many padding zeros as you want on filename
for ((i=0; i<1000; i+=1))
do
# Perform the actual screenshot grab
xwd -id $xwininfo -out $outfile-${padding:${#i}}$i.xwd
# Convert the xwd file to a better image format like PNG
convert $outfile-${padding:${#i}}$i.xwd $outfile-${padding:${#i}}$i.png
# Delete the converted XWD-file
rm -f $outfile-${padding:${#i}}$i.xwd
# wait
sleep $sleeping
done
Stop the script after you have grabbed enough screenshots.
I ended up with several files named outfile-000.png outfile-001.png ...
Deleted those files that were not needed and sent the images a documentation of the booting process.
Tags: bash, convert, PNG, windowid, wxd
Posted by Hans-Henry Jakobsen
This is a short post on how to install the necessary components to get X Server running on a bare bone RedHat 6 Enterprise Server (CentOS6) installation.
The following commands should be run from a console window as the root user.
Install barebone X support
# yum groupinstall "X Window System"
Install X and the Gnome Environment
# yum groupinstall "X Window System" "GNOME Desktop Environment"
Install X and the KDE Window System
# yum groupinstall "X Window System" KDE
Install the XFCE desktop environment
# yum groupinstall "X Window System" XFCE
When you have chosen your desired desktop environment, make the final change to make the Gnome Display Manager show you a logon screen.
Edit the file /etc/inittab and change the line
from
id:3:initdefault:
to
id:5:initdefault:
You will be greeted with a graphical logon screen the next time you have rebooted your server.
Tags: CentOS, KDE, rhel6, X, XFCE
Posted by Hans-Henry Jakobsen
I wanted to test corruption of a 41TB XFS filesystem and the dd command was the perfect tool for the job.
I used a block size of 512 bytes and wrote 10 blocks of data from device /dev/urandom to the partition /dev/sdb1.
The “Seek” option specifies how many blocks are skipped, counting 100 blocks from the beginning of the partiton, before writing the random/corrupted data.
# dd bs=512 count=10 seek=100 if=/dev/urandom of=/dev/sdb1
Caution!
This procedure WILL most likely corrupt your disk partition or files on the partition. Use it ONLY on test systems and with a valid backup!
Tags: dd
Posted by Hans-Henry Jakobsen
This is a one liner to remove white space in filenames using a linux console
# rename 'y/ /_/' *
You could also do this the other way, remove underscore with space
# rename 'y/_//' *
Tags: rename
Posted by Hans-Henry Jakobsen
This post is a short howto to fix/workaround the problem with low volume in some Ubuntu 11.04 installations.
The fix for me was to open a console window (as the user I’m logged in with) and start the alsamixer
# alsamixer
You will then see the alsamixer window. Use the left/right arrow keys and choose the device you would like to configure. In my case it was the headphone.

Choose which sound card you would like to configure on the headphone by pressing the F6-key. Make your choice and press the Enter-key.

Use your up/down arrow keys to choose the right volume for your configuration. You should have some audio playing while you configure to determine the right value.

Press the Esc key to exit alsamixer when you have found the right volume. Your settings are persistent and will survive a reboot.

You are now done with configuring your sound card.
Tags: 11.04, alsamixer, howto, Ubuntu
Posted by Hans-Henry Jakobsen