Consultor Eletrônico



Kbase P18385: How to shutdown a database via a script
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/09/2010
Status: Verified

GOAL:

How to shutdown a database via a script

GOAL:

How to use a script to shutdown a database using -F

FACT(s) (Environment):

UNIX
Progress/OpenEdge Product Family
Progress 8.x
Progress 9.x
OpenEdge 10.0x
OpenEdge 10.1x

FIX:

1. Create a file called shutdb which contains the following lines:

#!/bin/sh
# SHUTDB
# A sample UNIX script to shutdown a database.
# Usage: shutdb dbname

# Make sure syntax is correct
: ${1?"Usage: $0 dbname"}

dbname=$1

# Create the logging file
echo "Shut $dbname at 'date'" > shut.log

# start the proshut in the background
# be sure to put the & at the end of the proshut command
proshut $dbname -by >> shut.log 2>&1 &

# wait 15 Minutes or 900 seconds
sleep 900

# if the .lk is removed, shutdown complete
if [ ! -f $dbname.lk ]
then
echo Database shut 'date' >> shut.log
exit
fi

# if we got this far, perform force shutdown
proshut $dbname -by -F >> shut.log

echo Emergency shut 'date' >> shut.log

2. Then modify permissions to include execute rights:
chmod +x shutdb
3. To shutdown a database via this script issue command:

Syntax: shutdb <dbname>