Syntax of the find utility is made more complex by the need to escape some of its switches for use in a shell, but sooner or later you will run into a situation where you have too many files that need an operation for any other tool to manage.
The first time I ran into this situation was with some software that produced a log file with each event that was processed. When I noticed the file system was getting full, there were already millions of files that needed deleting. They each had a date stamp in their names but the normal way of 'wildcarding' for the oldest files:
Today I found out a single critical file was needed from one of the JFS2 filesystems I was working with the other day. I was able to recover the file and things are working again.
Following a fiber-channel card failure I was asked to help recover some corrupt JFS2 filesystems. They couldn't be fsck-ed but I was able to run fsdb to modify the filesystem meta-data. First I tried replacing their superblock structures which didn't help.
# fsck /dev/stgA
The current volume is: /dev/stgA
Primary superblock is valid.
J2_LOGREDO:log redo processing for /dev/stgA
Primary superblock is valid.
Invalid data detected in aggregate inode 2.
Invalid data detected in aggregate inode 2.
fsck: 0507-278 Cannot continue.
File system is dirty.
You can check the primary and secondary superblocks on your volume with the following commands.
# lquerypv -h /dev/stgA 8000 100 # try primary superblock
# lquerypv -h /dev/stgA F000 100 # try secondary superblock
On my system the output looks like this.
iptables v1.3 and newer come with a module 'recent' which allows users
to limit access based on time.
To allow only 3 connect attempts from any single IP address in any 2 minute window
# rule to accept but also log new ssh valid connections
iptables -N acceptlog
iptables -A acceptlog -j LOG --log-prefix "*** ACCEPT LOG ***"
iptables -A acceptlog -j ACCEPT
# rule runs against all new ssh connections, and drops repeat offenders
iptables -N SSH_CHECK
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_CHECK
iptables -A SSH_CHECK -m recent --set --name SSHDROP
A few days ago I spent half of my lunch break on google looking for a good way to make a row of 80
hash marks in the vi editor. Trust me, its a hard one to find in a search engine.
I did manage to figure it out today when one my my typos produced something similar.
To create a row of 80 hash marks in vi, press esc a few times to enter command mode and enter:
80i#[esc]
Here is an addition to /etc/profile to log 'root' login sessions on AIX using the command 'script' using ksh syntax.
# Script log each session to file
# jshunter
# friday 13 - 2008
if [[ ${USER} = "root" ]]; then
# Format todays date
DTE=$(date '+%Y-%m-%d_%H.%M.%S')
# Find the pty root is logging in on
MYTERM=$(ps $$ |grep $$ |awk '{print $2}')
# Use information in who command to get hostname
MYHOST=$(who |grep ${MYTERM}|awk '{print $6}'|sed 's/[\(\)]//g')
# Fork script shell and log info into a file named with date and host
I stumbled across this trick getting a printer to work on AIX. AIX uses a command called enq to submit jobs to its printing subsystem. For compatibility reasons it also includes commands like 'lp' and 'lpr' for submitting print jobs.
Typically one might send 'report.txt' to printer called 'mylp1' with the command:
lpr -P mylp1 report.txt
To find out what the underlying enq command receives mount it to /bin/echo
mount /bin/echo /bin/enq
Now running the lpw command above sends the enq parameter to /bin/echo which displays:
-P mylp1 -c -Bgn report.txt
I've been working on Postgres this morning, trying to find a way to export my Drupal data in a format that is useful on Bluehost. This pg_dump command comes fairly close, but the primary keys are getting mangled which is causing a bit of a problem.
pg_dump -O --no-acl --disable-dollar-quoting neworder1 |gzip >neworder1.sql1.gz
Postgres on Bluehost is restricted from seeing any of the Postgres system tables. If I can't find a workaround I'll have to re-create my databases from scratch.
I spent the latter half of yesterday setting up the Hylafax fax server software to send and receive faxes and also accept data calls over its modem using mgetty. There were a few tricks along the way to get it al working right.
Hylafax uses a separate configuration file for for each modem installed and is named after the serial device.
The first setting to get right is GettyArgs. This is where the command is passed through to mgetty. In my case the only argument I passed was %l which represents the modem device.
GettyArgs: " %l"
Bluehost does not allow TCP/IP connections to Postgres. They also rely on ident information when making the connection from php to Postgres.
Here are the steps that make things work:
#1 create a database mydb
#2 create a database user myuser
#3 add my user to database mydb
#4 in your Drupal directory. edit the files:
includes/install.pgsql.inc
includes/database.pgsql.inc
Look for the block of code that creates the connection string for the pg_connect command. Comment