#!/usr/bin/ksh ####################################################################3 # Lock all but selected users out of an environment # J. David Schronce Wed Sep 4 16:08:11 CDT 2002 ####################################################################3 # CONSTANTS WorkDir=/tmp STOPLAW=stoplaw STARTLAW=startlaw # Can only be run by root if [ `whoami` != "root" ]; then echo "$0 can only be run be root..." exit 1 fi # Make sure there is an environment if [ "X$LAWENVNAME" = "X" ]; then echo "\nNo Environment: . cv to SOURCE Environment...\n" exit 1 fi echo "\nNOTICE :Currently in * $LAWENVNAME * environment. If this is not the" echo "correct environment then press and cv to the correct one." echo "Otherwise, press to continue >\c" read dummy # See if Environment is running if [ `ps -ef | grep $LAWENVNAME | grep ladb | wc -l` -lt 2 ]; then echo "$LAWENVNAME Environment is not running..." exit 3 fi # Get parms echo "\nThis program will create a new USERS file for access to $LAWENVNAME" echo "based on your EXISTING Access Control List - it will stop and restart " echo "Lawson in the process" echo "\nFull Path to Access Control List > \c" read ACL if [ "X$ACL" = "X" ]; then echo "Cannot be null..." exit 4 fi # See if ACL exists if [ -f $ACL ]; then : else echo "$ACL does not exist..." exit 2 fi echo "Dumping current list of $LAWENVNAME users..." rngdbdump -nc GEN USER > $WorkDir/user.$LAWENVNAME.dmp echo "Copying USER tables in $LAWENVNAME..." cp -p $LADBDIR/GEN/USER $LADBDIR/GEN/USER.`date +%m%d%Y` cp -p $LADBDIR/GEN/USER.i $LADBDIR/GEN/USER.i.`date +%m%d%Y` #echo "Removing USER tables in $LAWENVNAME..." rm $LADBDIR/GEN/USER rm $LADBDIR/GEN/USER.i # Stop Env to clear USER data from cached memory $STOPLAW # Start Env $STARTLAW echo "Creating new user list from $ACL..." egrep -f$ACL $WorkDir/user.$LAWENVNAME.dmp > $WorkDir/user.$LAWENVNAME.new $GENDIR/importdb GEN USER $WorkDir/user.$LAWENVNAME.new echo "\n\nTo restore previous USER access run unlock_env.sh...\n\n"