Bash

warning: Creating default object from empty value in /home/phecht/public_html/ado/modules/taxonomy/taxonomy.pages.inc on line 33.

Jar listing utility--Java archive file tool. Handling import errors easily in 4 steps.

Here is a quick example on how to get a database of what is contained in jars:
Step
1 of 4) Create a file containing:
#!/bin/bash
jarfolder=/usr/share
jarlist=/tmp/jarlist.txt
declare -a jarclass
find $jarfolder -name "*.jar" > $jarlist
for jarfile in `cat $jarlist`;
do
jarname=`basename $jarfile`;
jarfolder=`dirname $jarfile`;

jarclass=( $( jar -tvf $jarfile | awk '{ print $8 }' ) )
for aclass in "${jarclass[@]}"
do
echo $jarname $jarfolder $aclass;
done
done

2 of 4) Edit top 2 lines if needed/wanted.

3 of 4) Run the script and capture the output. You will get output like this:
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/SessionEvent.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/TransferEventSupport.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/SessionEventSupport.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/resource/Resource.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/Wagon$1.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/Wagon.class

Note: The list has 3 fields: Jar file name, Jar path, Class name.

Checking disk space

Here is a quick and dirty diskspace script:

#!/bin/bash
ALERT=70
#ssh 10.61.37.176 df -H > /tmp/df.out
df -Hl > /tmp/df.out
cat /tmp/df.out | grep -vE 'Filesystem|tmpfs|cdrom' \
   | awk '{ print $5 " " $1 " " $6 }' | \
while read output ;
do
    usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
    partition=$(echo $output | awk '{ print $3 }' )
    if [ $usep -ge $ALERT ]
    then
       printf "Running out of space on partition %s \t %g \t %s %s\n" \
          $partition $usep $(hostname) $(date)
    fi
done

Notice the hard coded ALERT level as well as the commented out ssh command.

It needs work, but should show you how little space one has on all mounted drives.

new version of GnuWIn32 as of 10/18/08

http://gnuwin32.sourceforge.net/ I want to try out the new wget and getopts commands!

Shell scripts

A good reference for Bash: http://www.math.ucdavis.edu/~zjohnson/doc/Adv-Bash-Scr-HOWTO/
How can one remember the syntax of the if command?

Syndicate content