diff options
Diffstat (limited to 'abs/core-testing/LinHES-config/restore_default_settings.sh')
-rwxr-xr-x | abs/core-testing/LinHES-config/restore_default_settings.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/abs/core-testing/LinHES-config/restore_default_settings.sh b/abs/core-testing/LinHES-config/restore_default_settings.sh index 5690f48..46c5fc9 100755 --- a/abs/core-testing/LinHES-config/restore_default_settings.sh +++ b/abs/core-testing/LinHES-config/restore_default_settings.sh @@ -13,6 +13,7 @@ Thistemplate="" declare -i OVERRIDE=0 declare -i EVERYTHING=0 + function CMD_DEFINE () { #add override check if [ x$Thistemplate = xsyssettings -a $OVERRIDE -eq 1 ] @@ -28,21 +29,22 @@ function CMD_DEFINE () { } function SQL_DEFINE () { + thostname=`echo ${hostname}|tr - _` #$1 is the table name if [ $1 = "settings" ] then - ALTERSQL="Alter table temp_${1}_${hostname} add unique ( value )" + ALTERSQL="Alter table temp_${1}_${thostname} add unique ( value )" else ALTERSQL=";" fi - CREATESQL="create table temp_${1}_${hostname} like $1;" - COPY_TMP_SQL="replace into temp_${1}_${hostname} (select * from $1 where hostname=\"$hostname\");" - INSERTSQL="LOAD DATA local INFILE '/tmp/$1.txt' REPLACE INTO TABLE temp_${1}_${hostname} FIELDS TERMINATED BY '\t';" + CREATESQL="create table temp_${1}_${thostname} like $1;" + COPY_TMP_SQL="replace into temp_${1}_${thostname} (select * from $1 where hostname=\"$hostname\");" + INSERTSQL="LOAD DATA local INFILE '/tmp/$1.txt' REPLACE INTO TABLE temp_${1}_${thostname} FIELDS TERMINATED BY '\t';" #INSERTSQL="LOAD DATA local INFILE '$TEMPLATES/$Thistemplate/$1.txt' REPLACE INTO TABLE temp_${1}_${hostname} FIELDS TERMINATED BY '\t';" DROPSQL="delete from $1 where hostname=\"$hostname\";" - COPY_BCK_SQL="replace into $1 (select * from temp_${1}_${hostname} where hostname=\"$hostname\");" - DROP_TABLE="Drop table temp_${1}_${hostname}" + COPY_BCK_SQL="replace into $1 (select * from temp_${1}_${thostname} where hostname=\"$hostname\");" + DROP_TABLE="Drop table temp_${1}_${thostname}" } function ARG_ERR() { |