Looking through scripts
Every now and then at work I have to dig through a few scripts to find some off the wall command that is run at a specific time, and to run it manually. Today I had to find a few commands so I opened a script that controls the shutdown of all databases, and found a nice block of comment code that was left from a friend, best damn UNIX guy I know. I’ll post an excerpt of it here, taking out the stuff that I should really not make public for obvious reasons.
#### DO NOT try to fix this! ###
# The following loop is absolutely painful, and I know you THINK you
# know a better way to do this, but trust me, it won’t work. It will
# LOOK like it worked, and you won’t know the difference until you have
# to restore from the backup you created and it fails.
#
# The —– command used to shut down the databases completes
# successfully (return code 0) BEFORE the database is actually shut
# down (if you don’t believe me, call ——– ——— Corporation
# and ask them 000-000-0000. Therefore we cannot start truncating
# the —– just because —– completed successfully. The ——
# command used in this loop returns an exit code of 0 if the database
# is shut down, and some positive value otherwise. In this loop we
# go through all of the databases, add up the exit codes for each one,
# and repeat until the sum is 0 (meaning all databases are shut down).
# It would be easier to grep ‘ps -ef’ output for the ‘——-’ database
# server process, but so far we can’t get ——- Tech Support to
# confirm that no other process could be modifying database files,
# so this is the only method that has the ——– stamp of
# approval.
#
# — BEGIN brain dead loop –
Sorry, I just love finding odd bits of code from others during normal day operation.