Things I don't want to look for twice..

Monthly Archives: July 2012

Add timestamp to bash script logging

It’s easy. I needed to redirect all output (out and err) to a log file, with a timestamp. I usually used this just after the #!/bin/bash line:

exec &>/path/to/log/file.log

But this doesn’t insert an output. To do this, add the following while loop:

exec &> >( while read line; do echo “$(date): ${line}”; done > /path/to/log/file.log)


NFS share on Xen Server 5

The mount error is:

mount: mount to NFS server ‘xx.xx.xx.xx’ failed: System Error: Connection refused.

If you’ll check /var/log/messages, you’ll see something like:

portmap[4284]: Only binding to LOOPBACK address!

You should edit /etc/sysconfig/network on the NFS server and comment the following line:


After commenting the line, restart Portmap and ..magic! It works!

Change desktop wide background in Xubuntu 12.04

So, there are 3 backgrounds in the Xubuntu desktop. The one on your desktop after login, the one at the login screen, and the one at the loading part – boot and shutdown.

The one from the desktop is changeable using the right-click menu directly on your desktop, in the “Desktop Settings” menu.

The one from the login menu, you can change my editing the file called  /etc/lightdm/lightdm-gtk-greeter.conf which is actually a shortcut to /etc/alternatives/lightdm-gtk-greeter-config-derivative:

# background = Background file to use, either an image path or a color (e.g. #772953)
# theme-name = GTK+ theme to use
# font-name = Font to use
# xft-antialias = Whether to antialias Xft fonts (true or false)
# xft-dpi = Resolution for Xft in dots per inch (e.g. 96)
# xft-hintstyle = What degree of hinting to use (hintnone, hintslight, hintmedium, or hintfull)
# xft-rgba = Type of subpixel antialiasing (none, rgb, bgr, vrgb or vbgr)
font-name=Droid Sans 10

So, comment the original line and add a new one with the path to your jpg/png file.

To change the one at the loading screen, you’ll have to copy your jpg file to /lib/plymouth/themes/xubuntu-logo and if it’s a JPG, you should convert it to PNG using your favourite image editor software (GIMP), and save it to the same path. I tried it, and doesn’t work with JPG, only PNG. So let’s say you created a file called new_wallpaper.png in /lib/plymouth/themes/xubuntu-logo. After that, you should edit the file named xubuntu-logo.script which is in the same folder, and look for the following line:

background_image = Image(“xubuntu-greybird.png”);

Comment that, and add a new line with your new wallpaper like this:

/* background_image = Image(“xubuntu-greybird.png”); */
background_image = Image(“new_wallpaper.png”);

Reboot and watch the magic..