Re: Informix Application LOGOUT
Posted in 1996
bahmed@cris.com (Basheer Ahmed) writes: >Is there any way I can force the users to exit from the menu. I'm tempted to suggest witholding paychecks until IS policy is adheared to. But since that won't fly... >users .profile line has >exec c4gl_program I have written the following to proceed the backing up of the database, and the restarting of the transaction log. Of course, I haven't had a chance to test this yet, so I don't know for sure if it's going to work. Also, I think this would be much more elegant in perl, but I'm still learning that, so sh/sed does me just fine. Plus, I think this script is *total* overkill, but what the hell... I had fun writing it! -- CUT -- #/bin/sh #Header stuff clipped. Meat 'n Potatoes (Dan Quayle Style) below: ## Get PIDs for db processes (c4gl_program/isql/sacego/sperform/4gl's) DBPIDS=`ps -ac | sort -n | sed -n "/c4gl_program/b found /isql/b found /sacego/b found /sperform/b found /\\.4ge$/b found d b :found s/^ *//;s/ ..*//p" ## Blow em away: start nice, then get rough with signals sent for signals in 15 1 2 3 9; do for pid in ${DBPIDS}; do kill -${signals} ${pid} >/dev/null 2>&1 done sleep 5 # Give them a chance to die done ## Just in case, get rid of any sqlexecs now SQLEXECS=`ps -ac | sed -n "/sqlexec/s/ *\\([0-9][0-9]*\\) ..*/\\1/p"` if [ "${SQLEXECS}" ]; then for signals in 15 1 2 3 9; do for pid in ${SQLEXECS}; do kill -${signals} ${pid} >/dev/null 2>&1 done sleep 5 # Give them a chance to die done fi ## Wait a few seconds just to give everything a chance to die... sleep 15 -- ---------------------------------------------------------------------------- Daniel James - Database Administrator djames@statsci.com Data Analysis Products Division of MathSoft, Inc. (206) 283-8802 x284