Module: kamailio Branch: master Commit: 39756fff5776bb1bf38215e90bd19a859a287b93 URL: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a85...
Author: Fred Posner fred@palner.com Committer: Henning Westerholt henningw@users.noreply.github.com Date: 2019-02-17T19:38:33+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
---
Modified: utils/kamctl/kamdbctl
---
Diff: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a85... Patch: https://github.com/kamailio/kamailio/commit/39756fff5776bb1bf38215e90bd19a85...
---
diff --git a/utils/kamctl/kamdbctl b/utils/kamctl/kamdbctl index a8d429a728..45ed0f50d9 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"