#!/bin/ksh ################################################################################ # # File: switch_region # Description: A script to switch the registry region from one region to # another. # Author: Andrew DeFaria, California Language Labs # Created: Wed Jan 15 16:52:22 PST 1997 # Modified: Wed Jan 15 16:52:22 PST 1997 (Andrew DeFaria) defaria@cup.hp.com # Language: Korn Shell # # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved # ################################################################################ me=$(basename $0) function usage { print "Usage: $me: " exit 1 } # usage if [ $(id -u) -ne 0 ]; then print -u2 "$me: Error: Must be root to execute this command!" usage fi # Get parameters if [ $# -ne 1 ]; then usage; else new_registry_region="$1" fi registry_region_file=/usr/adm/atria/rgy/rgy_region.conf if [ -f $registry_region_file ]; then old_registry_region=$(cat $registry_region_file) if [ "$old_registry_region" = "$new_registry_region" ]; then print -u2 "$me: The registry region is already $new_registry_region" print -u2 "$me: Nothing changed!" exit fi cp $registry_region_file $registry_region_file.old print $new_registry_region > $registry_region_file print "$me: Switched registry region from $old_registry_region \c" print "to $new_registry_region." print "$me: Saved old registry setting in $registry_region_file.old" fi