[sr-dev] git:5.2:c07e85a8: kamdbctl: warn that drop cmd will drop existing DB, ask for confirmation (GH #1858)

Henning Westerholt hw at kamailio.org
Mon Feb 18 20:59:24 CET 2019


Module: kamailio
Branch: 5.2
Commit: c07e85a8031f771690f4da7f28ff31e265c98a60
URL: https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e265c98a60

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-18T20:59:05+01:00

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

---

Modified: utils/kamctl/kamdbctl

---

Diff:  https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e265c98a60.diff
Patch: https://github.com/kamailio/kamailio/commit/c07e85a8031f771690f4da7f28ff31e265c98a60.patch

---

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 62501a4420..ae44c5df45 100755
--- a/utils/kamctl/kamdbctl
+++ b/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"




More information about the sr-dev mailing list