There is usually some orphan packages left on the system after upgrading Ubuntu from one major version to another. These packages can cause strange errors like Ubuntu bug #151045. The solution to this problem is a package named deborphan. deborphan removes orphan packages that are left on your Ubuntu installation and you should run this program after any major Ubuntu upgrade.
Install and run deborphan
# sudo aptitude install deborphan # sudo deborphan
Result
liblzo1 libdb4.3 libsasl2
These files were listed on one of my Ubuntu 8.04 installations. This installation had been upgraded from a previous LTS version.
All we have to do now is to remove those orphaned packages
# sudo deborphan | xargs sudo aptitude purge -y
This howto has not been tested on a Debian distribution, but I guess it will work there also.
Tags: aptitude, deborphan, howto, Ubuntu, ubuntu hardy, xargs
Posted by Hans-Henry Jakobsen
This is a great page with som nice bash scripts describing how to remove unwanted modules from your kernel.
Tags: bash, cut, grep, kernel, lsmod, modinfo, sed, xargs
Posted by Hans-Henry Jakobsen
I’ve just migrated a couple of servers from Courier-IMAP to Dovecot, and am very happy with the latter so far. I thought I’d share the courier2dovecot shell script I whipped together (based on the instructions I found in the migration how-to), for converting Courier-IMAP maildirs to Dovecot format.
While the script is rather simple, it can save a fair bit of typing when migrating some hundreds of mail accounts, especially since Courier stores some of its own state files recursively in each folder of the maildir hierarchy, making it a real pain to otherwise manually rename or remove all of them.
Here’s a plain-English summary of what the script currently does, when given a Courier maildir path as an argument:
The script will also verbosely print out each action it performs, handy for redirecting the output to a log file for a large migration.
Hopefully people about to jump ship from Courier to Dovecot find this useful. If anyone comes up with improvements to the script, please send them my way.
#!/bin/sh # # courier2dovecot -- Converts a Courier maildir to Dovecot format. # Copyright (c) 2005 Arto Bendiken. Released under the GNU GPL. # Newest version available from http://bendiken.net/scripts/ # # 2005-10-21 initial version for Dovecot 1.0. # dir="$1" if [ -z "$dir" ] || [ "$dir" = "-?" ] || [ "$dir" = "-h" ] || [ "$dir" = "--help" ]; then echo "Usage: $0 maildirpath" exit 1 fi if [ ! -d "$dir" ] || [ ! -e "$dir/courierimapsubscribed" ]; then echo "$dir is not a path to a Courier maildir" exit 1 fi find $dir -name courierimapsubscribed -print0 | xargs -0r rename -v 's/courierimapsubscribed/subscriptions/' find $dir -name subscriptions -print0 | xargs -0r sed -i 's/INBOX\.//' find $dir -name courierimapuiddb -print0 | xargs -0r rename -v 's/courierimapuiddb/dovecot-uidlist/' find $dir -name courierimaphieracl -print0 | xargs -0r rm -vrf find $dir -name courierimapacl -print0 | xargs -0r rm -vf find $dir -name courierimapkeywords -print0 | xargs -0r rm -vrf
Comment to the script:
Hey Arto & everyone using this script:
Be careful when trying to run this on Red Hat Enterprise Linux or CentOS 4 systems. These operating systems ship with a different rename command than the Debian systems. You can also tell them apart based on the output when running ‘rename’ with no arguments.
This is the perl version which works:
Usage: rename [-v] [-n] [-f] perlexpr [filenames]
This is the RHEL/CentOS version that doesn’t:
call: rename.orig from to files…
Hope this helps someone out there, and thanks for the script Arto!
Source: http://bendiken.net/2005/11/03/courier-imap-to-dovecot-migration-script
Tags: CentOS, Courier-imap, Debian, Dovecot, Fedora, find, maildir, perl, RedHat, SMTP, xargs
Posted by Hans-Henry Jakobsen
The following shell script finds duplicate (2 or more identical) files and outputs a new shell script containing commented-out rm statements for deleting them.
You then have to edit the file to select which files to keep – the script can’t safely do it automatically!
OUTF=rem-duplicates.sh;
echo "#! /bin/sh" > $OUTF;
find "$@" -type f -print0 |
xargs -0 -n1 md5sum |
sort --key=1,32 | uniq -w 32 -d --all-repeated=separate |
sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF;
chmod a+x $OUTF; ls -l $OUTF
Example output (rem-duplicates.sh)
#! /bin/sh #rm ./gdc2001/113-1303_IMG.JPG #rm ./reppulilta/gdc2001/113-1303_IMG.JPG #rm ./lissabon/01-01-2001/108-0883_IMG.JPG #rm ./kuvat\ reppulilta/lissabon/01-01-2001/108-0883_IMG.JPG #rm ./gdc2001/113-1328_IMG.JPG #rm ./kuvat\ reppulilta/gdc2001/113-1328_IMG.JPG
Explanation
Tags: bash, find, JPG, md5, md5sum, sed, sort, uniq, xargs
Posted by Hans-Henry Jakobsen
find / -name '*html' -print \ | xargs grep -l 'www.example.com' \ | less -Opages
Posted by Hans-Henry Jakobsen