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

Author: Fred Posner <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2019-02-18T20:58:09+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/d0ee6bcd902bf95486ed02ea21b234bcc978894a.diff
Patch: 
https://github.com/kamailio/kamailio/commit/d0ee6bcd902bf95486ed02ea21b234bcc978894a.patch

---

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


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

Reply via email to