Better Living Through Thinking

Making 'find' go faster

Wed, 24 Oct 2007

The mysterious Unix find command has some interesting things about it. For one, the order of the command-line parameters is important--earlier commands affect later commands. The ramifications of this finally became clear to me after using find for 12 years.

So here is this and a few things I've learned over the years to make find go faster:

...

(read more...)

[ category: /sysadmin | link: find_optimization ]

Finding Mail Senders

Thu, 17 May 2007

mailsender finds all of the email addresses sending to a given recipient (e.g., joe@here.tld) in one or more logfiles (assumes modern sendmail-style log format with 'sm-mta' lines, etc.) This will not work for any other kind of MTA (e.g., exim, postfix, qmail, etc.)

Usage:

mailsender joe@here.tld /var/log/maillog /var/log/maillog.0.gz ...

...

(read more...)

[ category: /sysadmin | link: finding_mail_senders ]

Tell Even from Odd Days

Tue, 17 Apr 2007

Here's a small utility to tell even from odd days (useful in some crontabs):

#!/usr/bin/perl -s
exit(((localtime)[3]+($odd||0)) % 2);

Save this to /usr/local/sbin/evenday, chmod 755 /usr/local/sbin/evenday and chown root:wheel /usr/local/sbin/evenday ...

(read more...)

[ category: /sysadmin | link: evenday ]

histmbox - an mbox histogram generator

Fri, 13 Apr 2007

*updated: Fri Apr 13 11:39:12 MDT 2007*

histmbox reads one or more mbox-style mailbox files and prints out a histogram of how many message were received per day. This is useful for testing whether new mail filters are effective or not, for example.

Sample usage:

...

(read more...)

[ category: /sysadmin | link: histmbox ]

procsum - procmail log summary

Wed, 17 Jan 2007

*updated: Wed Jan 17 10:10:04 MST 2007*

procsum is a simple procmail log file summary tool.

Current version: 0.50 (released 2007/01/11 18:06:34)

Read the manpage:

<procsum_man.html>

Download procsum:

<procsum>

[ category: /sysadmin | link: procsum ]

rascals - stop brute force network attacks

Tue, 02 Jan 2007

*updated: Tue Jan 2 10:35:51 MST 2007*

Important update: rascals versions older than 1.10 (version 1.10 and newer are not affected) do not handle auth.log files that span a calendar year (i.e., go through December into January). This bug results in older attacks being revived as new attacks.

Beginning with version 1.10, rascals correctly handles this ...

(read more...)

[ category: /sysadmin | link: rascals ]

Find files older than a given time

Tue, 05 Dec 2006

We want to find files that are older than a specified time. We use the '-newer' option to 'find' and invert it. The BSD 'find(1)' manpage states:

-newerXY file
  True if the current file has a more recent last access time (X=a),
  change time (X=c), or modification time (X=m) than the last access
  time (Y=a), change time (Y=c), or modification time (Y=m) of file.
  In addition, if Y=t, then file is instead interpreted as a direct
  ...

(read more...)

[ category: /sysadmin | link: find_older ]

qmon - monitor user quotas

Tue, 30 May 2006

*updated: Tue May 30 10:28:03 MDT 2006*

qmon reports users who have reached a specified threshold percentage of their quota (default = 95%). You can change this threshold, as well as exclude specific users. If no users are over the quota threshold, no report will be given (making qmon suitable for putting into a crontab).

Current version: 1.1 (2006/05/30 16:25:37) ...

(read more...)

[ category: /sysadmin | link: qmon ]

Installing mod_dav

Mon, 23 Jan 2006

This document describes (briefly) how to setup mod_dav for a FreeBSD system.

1) Install mod_encoding.so

# cd /usr/ports/www/mod_encoding
# make && make install

Note: this step is only necessary if you have Windows XP clients ...

(read more...)

[ category: /sysadmin | link: mod_dav ]

retouch

Tue, 13 Sep 2005

retouch makes one or more files have the same date as another file.

Why would you want to do this? Here's what I do with it: sometimes I need to edit a blog entry (I use blosxom) but editing the entry changes the timestamp. I'm an emacs user, which renames the original file with a tilde (~) at the end. So now I can just do this:

...

(read more...)

[ category: /sysadmin | link: retouch ]

Audio Broadcast

(standby)

Moon Status

Phase: 87.62%
Illuminated: 14.38%
Age (days): 25.87
moon phase 0.876201283090479 Thu Mar 11 12:17:00 MST 2010