use at your own risk. Tested on Firebird 1.5 with Debian Etch packages
#!/bin/sh
IBASE_DATADIR=/home/system/firebird
IBASE_BACKUPDIR=/home/storage/backupdump/firebird
IBASE_ETCDIR=/etc/firebird2
GBAK=/usr/bin/gbak
IBASE_OPTIONS="-b -v"
IBASE_HOST="localhost:"
#IBASE_HOST=""
IBASE_USER=`cat $IBASE_ETCDIR/SYSDBA.password | grep ^ISC_USER | cut -d"=" -f2`
IBASE_PWD=`cat $IBASE_ETCDIR/SYSDBA.password | grep ^ISC_PASSWORD | cut -d"=" -f2`
#echo "I am going to connect as user $IBASE_USER with password $IBASE_PWD to host $IBASE_HOST"
# make directory with parents if needed
mkdir -p $IBASE_BACKUPDIR
for i in $IBASE_DATADIR/*.gdb; do
fbdb=`basename $i .gdb`
#echo "Found Interbase/Firebird DB : $fbdb";
IBDB_ALIAS=`cat $IBASE_ETCDIR/aliases.conf | grep $i | cut -d" " -f1`
#echo "Alias for that DB is: $IBDB_ALIAS."
#$GBAK $IBASE_OPTIONS -user $IBASE_USER -password $IBASE_PWD $IBASE_HOST$i $IBASE_BACKUPDIR/$fbfb.gbk
if [ -n "$IBDB_ALIAS" ]; then
$GBAK $IBASE_OPTIONS -user $IBASE_USER -password $IBASE_PWD $IBASE_HOST$IBDB_ALIAS $IBASE_BACKUPDIR/$fbdb.gbk
#echo "I will backup to $IBASE_BACKUPDIR/$fbdb.gbk"
else
echo "Found db-file $i but was not able to find an alias for it."
echo " db-file $i will not be backuped."
fi
done