[sr-dev] git:5.1:78043859: 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:30 CET 2019
Module: kamailio
Branch: 5.1
Commit: 780438599de627bfdc9406b7dd469767b35123f5
URL: https://github.com/kamailio/kamailio/commit/780438599de627bfdc9406b7dd469767b35123f5
Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-18T20:58:41+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/780438599de627bfdc9406b7dd469767b35123f5.diff
Patch: https://github.com/kamailio/kamailio/commit/780438599de627bfdc9406b7dd469767b35123f5.patch
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index e66f3eb4ce..ea15329a19 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -398,6 +398,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