Category: linux

  • High System CPU usage

    After upgrading a webserver running Apache to Debian Jessie (from Wheezy), I noticed that the system CPU usage was higher.  Running an strace on one of the Apache processes was giving me very little info: strace -c -p 10112 Process 10112 attached – interrupt to quit ^CProcess 10112 detached % time seconds usecs/call calls errors…

  • linux disk usage not adding up

    Umount file systems on that partition one by one and look for files in the mount point. When mounting a filesystem on a mount point any existing files in that mount point are not deleted. They just appear hidden when running du.  

  • Checking for the existence of domains from commandline in Bash

    while read line; do wget –quiet –spider –timeout=10 $line; if [ $? -ne 0 ]; then echo $line; fi; done < "/tmp/domains.txt" /tmp/domains.txt would hold the list of domain names separated by newline. Note this is just a quick hack and not entirely reliable.

  • Unix find, xargs and basename.

    Xargs is great. If you want to know why use xargs over exec, have a read of this: xargs versus exec. But, there is one problem. If the command that you are trying to execute on the results from find cannot take more than one file as param (basename for e.g, can take only one…

  • Munin: Could not open required defaults file: /root/.my.cnf

    For some reason I kept getting this error (even when the file was readable by all) in one of the munin (mysql slave) plugins that I had written. So this was the solution that worked for me; under the [mysql*] section in /etc/munin/plugin-conf.d/munin-node I added this: env.mysqlopts -u{user} -p{password} and in my plugin I did…

  • Fixing: “unknown terminal type” in shell

    Assuming you are using bash Add the following to ~/.bash_profile TERM=vt100 export TERM and then from shell source ~/.bash_profile Note: ‘vt100’ could be replaced with something similar in /usr/share/terminfo/