浏览代码

kamdbctl: added verification before reinit (#1852)

kamdbctl: added verification before reinit command (GH #1852)
- add get_answer and warning that reinit command will drop existing database
- even seasoned users forget and ther is no backing out, results in data loss
Fred Posner 6 年之前
父节点
当前提交
39756fff57
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      utils/kamctl/kamdbctl

+ 8 - 0
utils/kamctl/kamdbctl

@@ -386,6 +386,14 @@ case $1 in
 	reinit)
 	reinit)
 		# delete database and create a new one
 		# delete database and create a new one
 		# create new database structures
 		# create new database structures
+
+		# confirm dropping of database
+		echo -e "This will drop your current database and create a new one.\nIt is recommended to first backup your database.\n"
+		get_answer ask "Continue with reinit? (y/n): "
+		if [ "$ANSWER" != "y" ]; then
+			exit 1
+		fi
+
 		shift
 		shift
 		if [ $# -eq 1 ] ; then
 		if [ $# -eq 1 ] ; then
 			DBNAME="$1"
 			DBNAME="$1"