diff --git a/xCAT-server/share/xcat/scripts/xcat_db_backup.sh b/xCAT-server/share/xcat/scripts/xcat_db_backup.sh new file mode 100755 index 000000000..1ff54180f --- /dev/null +++ b/xCAT-server/share/xcat/scripts/xcat_db_backup.sh @@ -0,0 +1,18 @@ +#!/bin/sh +#-- script backs up xCAT database to csv files into (newly created) directory +#-- jurij.sikorsky@t-systems.cz + +basedir=/scratch/xcat/backup +dirname=$basename/xcatdb-`hostname`-`date +%y%m%d-%H%M%S` +echo $dirname +mkdir $dirname +cd $dirname + +for tab in `/opt/xcat/sbin/tabdump`; do + echo $tab + tabdump $tab > $tab.csv +done + + +cd - > /dev/null + diff --git a/xCAT-server/share/xcat/scripts/xcat_db_restore.sh b/xCAT-server/share/xcat/scripts/xcat_db_restore.sh new file mode 100755 index 000000000..173d364b9 --- /dev/null +++ b/xCAT-server/share/xcat/scripts/xcat_db_restore.sh @@ -0,0 +1,13 @@ +#!/bin/sh +#-- script restores xCAT database from directory with csv files, +#-- created by xcat_db_backup.sh script +#-- jurij.sikorsky@t-systems.cz + +dirname=$1 + +if [[ -z $dirname ]]; then echo "Usage: $0 {backup dir}"; exit 1; fi + +for tab in $dirname/*.csv; do + echo $tab + tabrestore $tab +done