Consultor Eletrônico



Kbase P111982: How to perform a conditional shutdown of a database via dbman.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

GOAL:

How to perform a conditional shutdown of a database via dbman.

GOAL:

How to shutdown of database via dbman when no users are connected to it.

FACT(s) (Environment):

UNIX

FIX:

Currently (Progress 9.1E and OpenEdge 10.0B) dbman does not provide the possibility to perform a conditional shutdown; the command dbman -stop indeed requests an unconditional shutdown of the database, much like proshut with the -by option.

proshut does offer the possibility of shutting down the database conditionally, but you must run it as the operating-system user that started up the database or as root, which is not always allowed.

As a consequence, a conditional shutdown of a database is only possible by using a script to detect whether there are connected users, and using dbman -stop once we have secured that no user is connected, like the following:

#!/bin/sh
users=`proshut <physical db name> -C list | grep -v "^usr *pid" | awk '{ print $8}' | fgrep -v "apw
biw
aiw
wdog"`
[ -z "$users" ] && dbman -db <db> -stop

- Command proshut ... lists the users currently connected. Please note that you have to use the physical database name.
- Command grep -v ... removes the header line from the output.
- Command awk ... reduces the output to only the 8th column, which is the userid of the connected users.
- Command fgrep -v ... filters out any Watchdog, APW's, BIW and AIW that might be running.
What is the left in variable $users is the list of the user id's of all connected users. If that list is empty, then dbman -db <db> -stop is executed. Please note that you have to use the logical database name as specified in the AdminServer, and visible via the Progress Explorer.