Tuesday, April 14, 2009

Vacuumdb within crontab

Vacuumdb for postgres is best run in a cron. But when your database user needs a password, export it and the cron will run without a problem. Here is an example of a vacuumdb instance that exports the password and then does a full, quiet, and analyzing vacuumdb on the mydatabase database.

Clean, vacuum and analyze the tripplanning database
0 2 * * * export PGPASSWORD=mypassword && vacuumdb -f -q -z -U postgres -d mydatabase >> /var/log/messages 2>&1

Tuesday, April 7, 2009

Take a network trace on HP UX

I needed to take a trace on an HP UX server the other day. These are the commands that I used:

nettl -tn 0x30800000 -e ns_ls_ip -tracemax 99999 -f /tmp/networkTrace

Then to kill it before it got to 99999 lines, I used the command

nettl -tf -e all

Then I analyzed /tmp/networkTrace with Wireshark.

Wednesday, April 1, 2009

zipidey-do daw, zipidey-de day, what a wonderful day!

The zip command will create a zip file that can be used across disparate platforms, including Linux/Unix to Windows or Mac. In other words, if you need to send your Windows friend several ziped files and he can only deal with .zip files, keep it simple. Don't use bzip or tar, just use zip. Here is a command to create a highly compressed zip file to contain some log files. Then just get the produced zipfile to your Windows "without walls" friend.

zip -9 logServices.zip /var/log/messages myapp/logs/mylog.log /usr/local/tomcat/logs/catalina.out

Add an temporary user account

If you need an account for a set period of time, or an account that you don't want to deactivate later, add the -e option on useradd:

useradd -m -e 2009-12-01 -c "Temp Account" tempUser

This user account will expire on December 1st, 2009 and will lock the user and their password.