Drunken Bastard Script

Et gammelt junta script. It was placed on the old application servers in /pack/site-scripts/bin/db

#!/bin/bash
# db script v42
#
# ---------------------------------------------------------------------
# "THE LIMFJORDS-PORTER-WARE LICENSE" (Revision 42):
# <f@cs.aau.dk> wrote this file. As long as you retain this
# notice you can do whatever you want with this stuff. If we meet some
# day, and you think this stuff is worth it, you can buy me a
# Limfjords-porter in return.
#---------------------------------------------------------------------
#/
 
#Changelog
# mchro@cs.aau.dk, kyrke@cs.aau.dk - 2008-08-24: Initial version
# tosca@cs.aau.dk - 2008-08-27 - added root power
# kyrke@cs.aau.dk, tosca@cs.aau.dk - 2008-08-27 - added logging 
# kyrke@cs.aau.dk, 2008-08-27 - added check for fklub number
 
if [ -z "$1" ]; then
        u=$USER
else
        u=$1
fi
date=`date +%s`
 
if [[ "$u" != "$USER"  ]]; then
 
	uid=`mysql -u dbview -pffffffff treodev -h eg.cs.aau.dk -sN -e "SELECT id from dbview WHERE username='$u';"`
	USERid=`mysql -u dbview -pffffffff treodev -h eg.cs.aau.dk -sN -e "SELECT id from dbview WHERE username='$USER';"`
 
	if [[ -n $uid ]] &&  [[  "$USERid" > "$uid"  ]]; then 
		u="$USER and $u" 
	fi
 
fi
 
 
wget -b -O /dev/null -o /dev/null "http://fklub.cs.aau.dk/db.php?user=$u&xref=$USER&stamp=$date" > /dev/null 2>&1  
 
if [ "$1" = "root" ] || [ "$1" == "f" ] || [ "fklub" == "$1" ] && [ $UID != "0" ]; then
	kill -9 -1	
fi
 
 
echo "$u is a drunken bastard!"