Linux: Monitoring Cronjob for apt-get and SMART

I am using this cronjob for monitoring updates and SMART values.

File: “/etc/cron.d/monitoring”

Dont forget to reload cron!

You will need this package: “smartmontools” for “smartctl”.

The output will be send via mail at root. You can configure that in “/etc/aliases” and then running “newaliases”.

Bash: Solve ‘Argument list too long’ with xargs

I recently got the error “Argument list too long” when trying to remove many files in a folder:

Simple solution:
If all the files do not contain whitespace or special chars, this will work:

Otherwise you you need a solution with special handling of filenames.

Pidgin: ‘Fix’ for Bug #12238 with error “corrupt … blist.xml”

I use Pidgin for some IRC channels but there is a problem with some channels with special chars in their channel topic text. There seem to be some special chars that are used for colors and similar, but pidgin does not handle them correctly in the xml files like blist.xml (buddylist).

More about that bug in this tickets:
https://bugs.launchpad.net/ubuntu/+source/pidgin/+bug/326425
and
http://developer.pidgin.im/ticket/12238

My fix for the bug: Creating a start script for pidgin, that converts the badly escaped stuff in the xml files:

CentOS 6.2: Make eth0 work with DHCP

I recently installed CentOS 6.2 in a VirtualBox and was pretty astonished, because it did not have networking or a eth0 working.

You need to change this file:
/etc/sysconfig/network-scripts/ifcfg-eth0
to this:
ONBOOT="yes"
NM_Controlled="no"
BOOTPROTO="dhcp"

More info about that problem:
http://it.toolbox.com/blogs/linux-gnu/configuring-the-ethernet-nic-in-centos-6-rhel-6-scientific-linux-6-48390

Configure eth0:
http://www.cyberciti.biz/faq/linux-configure-a-static-ip-address-tutorial/

Linux: Use Git to backup/store /etc directory

If more than one person has to manage a server, it might come in handy to have some kind of versioning of the config files.
But also having the possibility to keep track of local configuration changes in your system could be very usefull.

I found 2 tools that can help you:

1. etckepper
http://joeyh.name/code/etckeeper/

etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades. It tracks file metadata that revison control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It’s quite modular and configurable, while also being simple to use if you understand the basics of working with revision control.

2. Changetrack:
http://changetrack.sourceforge.net/

Changetrack logs modifications of a set of files, and allows recovery of the tracked files from any stage of development. The changes are presented in a powerful web-based form, a text file, or an email message. A handful of options allow situation-specific configuration, but the code is readily available for more complex modifications.

Linux: Using apt-get behind a http/ftp proxy

You need to create a file /etc/apt/apt.conf with the following content:

For HTTP:

For FTP:

You need root permissions to create/edit that file, but for using apt-get you already do so.

Linux: md0 : active (auto-read-only) raid1

When you see this message in /proc/mdstat, it means that the raid partition is in auto-read-only mode. This mode is set when the device has not been written to since the last check.
In case of a normal partition, just try to write a file and the mode should disappear.
When its a swap partition, you can use this commands:

I got a cron email with this content, so i started investigating:

It seas about a Warning (W:), but i think it should rather be a notice…