Module: kamailio
Branch: 5.1
Commit: d0da5663bf5761a68c6e135c270ab637539f74a4
URL: 
https://github.com/kamailio/kamailio/commit/d0da5663bf5761a68c6e135c270ab637539f74a4

Author: Fred Posner <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2019-02-18T20:58:14+01:00

 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

(cherry picked from commit 39756fff5776bb1bf38215e90bd19a859a287b93)

---

Modified: utils/kamctl/kamdbctl

---

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

---

diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl
index 224111b9fb..e66f3eb4ce 100755
--- a/utils/kamctl/kamdbctl
+++ b/utils/kamctl/kamdbctl
@@ -409,6 +409,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"


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to