Просмотр исходного кода

kamdbctl: warn that drop cmd will drop existing DB, ask for confirmation (GH #1858)

    - warn that the drop command will drop existing DB, ask for confirmation
    - manually merge pull request GH #1858 from fredposner, fred at qxork dot com
Henning Westerholt 6 лет назад
Родитель
Сommit
c07e85a803
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      utils/kamctl/kamdbctl

+ 8 - 0
utils/kamctl/kamdbctl

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