hcibox -n siteXY THREAD1,THREAD2,THREAD3 r siteXY_box
You can safely skip the locked files when copying. These are most likely the shared memory and runtime files which are not needed in the backup.
#!/usr/bin/kshclearecho ""showrootecho ""echo "Is this the site you want to move to another machine?"echo "(y to continue; anything else to quit)"read xyzif [ "$xyz" != "y" ]; then exitfiif [[ ! -d /upgrade ]]; then echo "FATAL ERROR - need to manually create /upgrade directory" exitfiif [[ ! -d /upgrade/new_box ]]; then echo "FATAL ERROR - need to manually create /upgrade/new_box directory" exitficd /upgrade/new_boxrm -rf /upgrade/new_box/$HCISITE /upgrade/new_box/$HCISITE.tarmkdir /upgrade/new_box/$HCISITEtar_tar_dir.ksh $HCISITEDIR /upgrade/new_box/$HCISITEtar -cvf $HCISITE.tar ./$HCISITErm -rf /upgrade/new_box/$HCISITE
#!/usr/bin/ksh# Begin Module Header ==============================================================================##------# Name:#------## untar_prep_site.ksh##---------# Purpose:#---------## Use the tar file from running tar_site_to_move.ksh to create a new site.###--------# Inputs:#--------## $1 = name of the original site used to create the tar_site_to_move# $2 = name of the new site to create##-------# Notes:#-------## Here is an example of normal usage of this script## untar_prep_site.ksh test_sms_genie t_sms_genie## Using this script will take care of many of the tasks associated with creating a new site at MDACC,## This script along with tar_site_to_move.ksh is especially usefull for any of the following:## - create a new site that is a copy of an existing site# - move a site from one machine to another##---------# History:#---------## 2009.01.12 Russ Ross# - wrote initial version# by converting the hardcoded version he had used during cloverleaf upgrades for many years.## 2012.12.10 Russ Ross# - added logic to clean out site_startup_backups directory## 2015.02.17 Russ Ross# - added clean up logic to get rid of# #MDA_UPDIR/new_box/$site_name/scripts/site_shutdown.ksh# $MDA_UPDIR/new_box/$site_name/scripts/site_startup.ksh# End of Module Header =============================================================================#----------------------------------------------------------# set the MDA_UPDIR environment variable if not already set#----------------------------------------------------------if [[ "`echo $MDA_UPDIR`" = "" ]]; then export MDA_UPDIR=/upgradefi#---------------------------------------------# make sure this script is run by the hci user#---------------------------------------------me=`whoami`if [ "$me" != "hci" ]; then echo "" echo " $0 must be run as hci" echo "" exit 1fi#----------------------------------------------# check if old site name was give as argument 1#----------------------------------------------site_name="$1"if [ "$site_name" = "" ]; then echo "" echo "***** ERROR - must supply OLD site name *****" echo "" echo "Here is one example of normal usage of this scripts:" echo "" echo " untar_prep_site.ksh test_sms_genie t_sms_genie" echo "" exit 2fi#------------------------------------------------------# see if a tar file exists for the old site to be moved#------------------------------------------------------cd $MDA_UPDIR/new_boxif [[ ! -a $site_name.tar ]]; then echo "" echo "***** ERROR - no file called ( $site_name.tar ) in directory ( $MDA_UPDIR/new_box ) *****" echo "" echo "Here is what is in directory ( `pwd` )" echo "" ls -al echo "" exit 3fi#---------------------------------------------------# check if the new site name was given as argument 2#---------------------------------------------------new_site="$2"if [ "$new_site" = "" ]; then echo "" echo "***** ERROR - must supply NEW site name *****" echo "" echo "--------------------------------------------" echo "Here are some of the possible site prefixes:" echo "--------------------------------------------" echo "" echo " mda_global" echo " p_mock_" echo " p_new_" echo " p_old_" echo " p_real_" echo " prod_batch" echo ' prod_batch_###' echo " test_upgrade" echo "" echo " mda_global" echo " t_" echo " test_batch" echo ' test_batch_###' echo " test_upgrade" echo "" echo "Here is one example of normal usage of this scripts:" echo "" echo " untar_prep_site.ksh test_sms_genie t_sms_genie" echo "" exit 4fi#-----------------------------------------------------# check to be sure the new site does not already exist#-----------------------------------------------------### if [[ -d $HCIROOT/$new_site ]]; thenif [ "`ls $HCIROOT/$new_site 2>/dev/null`" ]; then echo "" echo "***** ERROR - the new site ( $new_site ) already exist" echo "***** you will need to rename or delete it and rerun this script again" echo "***** this script is terminating without taking any action" echo "" exit 5fi#------------------------------------------# create the new site and update server.ini#------------------------------------------### if [[ ! -d $HCIROOT/$new_site ]]; thenif [ ! "`ls $HCIROOT/$new_site 2>/dev/null`" ]; then echo "" echo "==============================" echo "" echo " About to do ( hcisiteinit $new_site )" echo " respond y to accept" echo " any other response will abort this script" echo "" read response if [[ "$response" != "y" ]]; then echo "" echo "This script has been terminated without doing any action." echo "" exit 6 fi echo "" echo " creating new site ( $new_site )" echo "" hcisiteinit $new_site set_server_ini_environs.ksh if [[ ! -d $HCIROOT/$new_site ]]; then echo "" echo "***** ERROR - hcisiteinit did not create directory ( $HCIROOT/$new_site ) *****" echo "" exit 7 fifi#------------------------------------------------# replace the site directory with a symbolic link#------------------------------------------------if [[ ! -d /sites ]]; then echo "ERROR will need to create /sites file system" exit 9fiif [[ ! -d /sites/$HCIVERSION ]]; then mkdir /sites/$HCIVERSIONfiif [[ -d /sites/$HCIVERSION/$new_site ]]; then echo "ERROR /sites/$HCIVERSION/$new_site already exists" exit 9fiif [[ ! -d /sites/$HCIVERSION/$new_site ]]; then mkdir /sites/$HCIVERSION/$new_site mkdir /sites/$HCIVERSION/${new_site}/`date +"v01_%Y.%m.%d"`fitar_tar_dir.ksh $HCIROOT/$new_site /sites/$HCIVERSION/${new_site}/`date +"v01_%Y.%m.%d"`rm -rf $HCIROOT/$new_siteln -s /sites/$HCIVERSION/${new_site}/`date +"v01_%Y.%m.%d"` $HCIROOT/$new_site#-------------------# untar the old site#-------------------cd $MDA_UPDIR/new_boxrm -rf $site_nametar -xvf $site_name.tarif [[ ! -d $MDA_UPDIR/new_box/$site_name ]]; then echo "" echo "***** ERROR - tar extract did not create directory ( $MDA_UPDIR/new_box/$site_name ) *****" echo "" exit 8fi#---------------------------------------------------------------------------# clean up the old site in preparation of using it to overwrite the new site#---------------------------------------------------------------------------cd $MDA_UPDIR/new_box/$site_namerm -rf `ls -al | grep "^-" | awk '{print $9}' | grep -v "^NetConfig$"`rm -rf execrm -rf lock; mkdir lockrm -rf logs; mkdir logsrm -rf revisions; mkdir revisionsrm -rf stats; mkdir statsrm -f ./Alerts/qdx*_hide_default.alrt#---------------------------# get rid of all *.bak files#---------------------------cd $MDA_UPDIR/new_box/$site_namefind . -name "*.bak" -exec rm -rf {} ;find . -name "backup" -exec rm -rf {} ;find . -name "x.x" -exec rm -rf {} ;find . -name "core" -exec rm -rf {} ;#-------------------------------------------------------------------------# make sure the site specific tclprocs directory only contains *.tcl files#-------------------------------------------------------------------------cd $MDA_UPDIR/new_box/$site_name/tclprocsrm -rf `ls -l | grep -v "^-" | awk '{print $9}'`rm -f `ls -1 | grep -v ".tcl$"`rm -f .*.tcl#----------------------------------------------------------------------# make sure the site specific Xlate directory only contains *.xlt files#----------------------------------------------------------------------cd $MDA_UPDIR/new_box/$site_name/Xlaterm -rf `ls -l | grep -v "^-" | awk '{print $9}'`rm -f `ls -1 | grep -v ".xlt$"`rm -f .*.xlt#---------------------------------------------# clean out the site_startup_backups directory#---------------------------------------------rm -rf $MDA_UPDIR/new_box/$site_name/scripts/site_shutdown.kshrm -rf $MDA_UPDIR/new_box/$site_name/scripts/site_startup.kshrm -rf $MDA_UPDIR/new_box/$site_name/scripts/site_startup_backups/*#--------------------------------------------------# set the ownership of the entire site to hci:staff#--------------------------------------------------chown -R hci:staff $MDA_UPDIR/new_box/$site_name#-----------------------------------------# tar_tar_dir the old_site to the new_site#-----------------------------------------if [[ -d $HCIROOT/$new_site ]]; then echo "" echo "==============================" echo "" echo " About to do ( tar_tar_dir $MDA_UPDIR/new_box/$site_name $HCIROOT/$new_site )" echo " respond y to accept" echo " any other response will abort this script" echo "" read response if [[ "$response" != "y" ]]; then echo "" echo "This script has been terminated without doing." echo "" echo " tar_tar_dir $MDA_UPDIR/new_box/$site_name $HCIROOT/$new_site " echo "" exit 9 fi tar_tar_dir.ksh $MDA_UPDIR/new_box/$site_name $HCIROOT/$new_sitefi#--------------------------------------------------------# create the process directories defined in the NetConfig#--------------------------------------------------------echo ""echo "creating the process directories"procList=`grep "^process" $HCIROOT/$new_site/NetConfig | awk '{print $2}' | sort`cd $HCIROOT/$new_site/exec/processesfor proc in $procList; do rm -rf $proc; mkdir $procdonels -alecho ""#--------------------# link data directory#-------------------- echo "" echo "---------------" echo "ln -s /data/$new_site $HCIROOT/$new_site/data" echo "---------------" echo "" if [[ ! -a /data/$new_site ]] then echo "" echo "creating /data/$new_site directory to link too" echo "" mkdir /data/$new_site ln -sf /data/$new_site $HCIROOT/$new_site/data else if [[ -a $HCIROOT/$new_site/data ]] then rm -rf $HCIROOT/$new_site/data; fi ln -sf /data/$new_site $HCIROOT/$new_site/data fi#---------------# make TCL index#--------------- echo "" echo "Doing a mktclindex" cd $HCIROOT/$new_site/tclprocs mktclindex ls -al echo ""#------------------------------------------------# clear database for safety# and reset shared memory pointer/file for safety#------------------------------------------------echo ""echo "About to clear data base for safety"myRoot=$HCIROOTmySite=$SITEsetroot -clearsetroot $myRoot $new_siteshowrootclear_db.kshcd $HCIROOT/$new_site/execrm -f monitorShmemFilehcimsiutil -Rsetroot -clearsetroot $myRoot $mySite#-------------------------------------------# hide Alerts and clean out Alerts directory#-------------------------------------------echo "Hiding alerts and cleaning out Alerts directory"if [[ ! -d $HCIROOT/$new_site/Alerts ]] then echo "ERROR - no Alerts direcotry exists" exitficd $HCIROOT/$new_site/Alertscp -p default.alrt .hide_original__default.alrtrm -rf *cp -p .hide_original__default.alrt hide_default.alrtcp $HCIROOT/siteProto/Alerts/off.alrt .ln -sf off.alrt default.alrtls -alecho ""#----------------------------------------------------# reminder to manually create the data subdirectories#----------------------------------------------------echo ""echo "************"echo "IMPORTANT -- you will have to manually create the /data/$new_site subdirectories"echo "ALSO; do a save in the GUI NetConfig to see if any errors show up in addition to doing a netcheck"echo "ALSO; a symbolic link for default.alrt has been set to point to off.alrt"echo "************"echo ""
@echo offclsremremrem Batch to backup interface site data to the network$ folderremremrem %1 - source (ex. C:cloverleafcis6.1integrator)rem %2 - site name (abcdefg)rem %3 - destination (ex. \servershare$)rem %4 - processes (ex. "ADT,DFT,SIU")rem rem ---------------------------------------------------------------------rem Version Date Init Changes rem ---------------------------------------------------------------------rem 1.0.00 06/28/2016 lbetscha Initial Versionrem ---------------------------------------------------------------------setlocalset LOG_FILE=%~dp0robo_log.logset BACKUP_LOG_FILE=%~dp0backup.logrem ---------------------------------------------------------------------echo.echo ****************************************echo Set Site...set site=%2echo Site - %site%echo Site - %site% > %BACKUP_LOG_FILE%rem ---------------------------------------------------------------------echo.echo ****************************************echo Set Source...set source=%1%site%echo Backup from - %source%echo Backup from - %source% >> %BACKUP_LOG_FILE%rem ---------------------------------------------------------------------echo.echo ****************************************echo Create Backup Folder...set backupfolder=%3interface%site%echo Backup destination - %backupfolder%echo Backup destination - %backupfolder% >> %BACKUP_LOG_FILE%md %backupfolder%rem ---------------------------------------------------------------------echo.echo ****************************************echo Set Processes...echo Processes - %4echo Processes - %4 >> %BACKUP_LOG_FILE%rem ---------------------------------------------------------------------echo.echo ****************************************echo Set cloverleaf environment variablesCALL d:cloverleafcis6.1integratorsbinsetroot.cmdCALL d:cloverleafcis6.1integratorsbinshowroot.cmdrem ---------------------------------------------------------------------echo.echo ****************************************echo Stop cloverleaf processeshcienginestop -p %4rem ---------------------------------------------------------------------echo.echo ****************************************echo Starte Sicherung...robocopy %source% %backupfolder% /MIR /B /XD "%source%exec" /E /COPY:DAT /LOG:%LOG_FILE% /R:10 /W:30echo.echo Sicherung abgeschlossen.rem ---------------------------------------------------------------------echo.echo ****************************************echo Clean up cloverleaf processes...hcilmclear -p %4echo.echo Clean up abgeschlossen.echo.echo ****************************************echo Start cloverleaf processes...hcienginerun -p %4