Quellcode durchsuchen

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 vor 6 Jahren
Ursprung
Commit
39756fff57
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
  1. 8 0
      utils/kamctl/kamdbctl

+ 8 - 0
utils/kamctl/kamdbctl

@@ -386,6 +386,14 @@ case $1 in
 	reinit)
 		# delete database and create a new one
 		# 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
 		if [ $# -eq 1 ] ; then
 			DBNAME="$1"