Slightly more advanced uses of find for finding files between two dates/times

I’ve used find commands before and talked about them on Unixsupport.com, however I recently needed to stack a few find commands and found it less then easy to search out support… so:

find . \( -ctime +1 -not -ctime +3 \) | xargs -I{} ls -l {}

find files, in the current directory, that were created more then 1 day ago, not, more then 3 days ago, then send them over to ls to show them to me

Comments

Using wget to simulate a WAP browser

I needed to do some testing of a wap specific website, but it would error or redirect me if I hit it with a web browser… wget to the rescue

wget -O - -U “MOT-8720_/00.62 UP.Browser/6.2.3.4.c.1.104 (GUI) MMP/2.0″ –header=”Accept: text/vnd.wap.xhtml” http://www.yourwebsite.com/wap/

I pulled a browser string from my web logs, attached the accept text/vnd.wap.xhtml since I knew it needed that for the site and bingo

Comments

Nagios exec logging

Nagios can be a pain in the butt to troubleshoot because finding out what it is passing to it’s plugins isn’t easy to log.

A friend says that this works, haven’t tried it yet, but it seems logical.

strace -s 4096 /usr/local/nagios/bin/nagios -c /usr/local/nagios/etc/nagios.cfg 2>&1 | vim -

syntax on
set filetype=strace

Comments

Simple Testing of SMTP with Telnet

SMTP is a pretty straightforward protocol, and thats why it is so simple for spammers to mess with, but it also makes it easy for us to test if its working.

Many times you want to verify your server before bringing it live in your MX record or even just test to make sure everything is good on your sendmail side.

Simple way of doing this is using telnet from the command line:

$ telnet your.mail.server.name.com 25

Trying your.mail.server.name.com…
Connected to your.mail.server.name.com.
Escape character is ‘^]’
220 your.mail.server.name.com ESMTP Sendmail 10.0.1/10.0.1; Mon, 13 Aug 2007 18:36:27 -0400 (EDT)

HELO your.doman.com
250 your.mail.server.name.com, nice to meet you!
MAIL FROM:you@your.domain.com
250 2.1.0 you@your.domain.com… Sender ok

RCPT TO:me@your.domain.com
250 me@your.domain.com… Recipient ok
DATA
354 Enter mail, end with “.” on a line by itself

Put your message here, and finish with a line that
only contains a period, so hit enter, then hit period, then hit enter, like below
.

250 2.0.0 l7DMerMV044784 Message accepted for delivery
QUIT

That should give you a good idea of what areas are having issues, so if you receive something like:
550 5.7.1 someone@someother.com… Relaying denied

you know that the mail server isn’t setup to receive messages for that user, or that the server is mis-configured for relaying.

Comments

Setting the time zone in FreeBSD

Couldn’t figure out how to set the timezone on my FreeBSD router/server box.

Found a mailing list post that suggested copying the appropriate file (in my case, PST8PDT) from /usr/share/zoneinfo to /etc/localtime. It worked well.. probably not perfect, but ;)

Comments

Find out what perl modules you have currently

Some simple cpan trickery to save you some sanity on cloning a box, finding out what perl modules are installed will save you some hassle later when your scripts won’t run:

$ perl -MCPAN -e shell

cpan> install ExtUtils::Installed
cpan> quit

$ perldoc perllocal

will give you a list of what you have installed.

Comments

« Previous entries ·