diff --git a/src/commandline.sh b/src/commandline.sh index 5c7647e..7455fb0 100644 --- a/src/commandline.sh +++ b/src/commandline.sh @@ -25,6 +25,8 @@ Options: -u, --update Force update check -c, --channel Switch to specified update channel -s, --cleanup Perform cleanup + -r, --restart Restart containers + --update-ns Update Nightscout and Mongo containers -h, --help Show this help message EOF } @@ -33,7 +35,7 @@ parse_commandline_args() { load_update_channel - CMDARGS=$(getopt --quiet -o wvldpuc:sh --long watchdog,version,loud,develop,production,update,channel:,cleanup,help -n 'nightscout-tool' -- "$@") + CMDARGS=$(getopt --quiet -o wvldpuc:srh --long watchdog,version,loud,develop,production,update,channel:,cleanup,restart,update-ns,help -n 'nightscout-tool' -- "$@") # shellcheck disable=SC2181 if [ $? != 0 ]; then @@ -104,7 +106,17 @@ parse_commandline_args() { NONINTERACTIVE_MODE=true do_cleanup_all exit 0 - ;; + ;; + -r | --restart) + NONINTERACTIVE_MODE=true + do_restart + exit 0 + ;; + --update-ns) + NONINTERACTIVE_MODE=true + do_update_ns + exit 0 + ;; -h | --help) help exit 0 diff --git a/src/logic_app.sh b/src/logic_app.sh index 0caf170..7c541d5 100644 --- a/src/logic_app.sh +++ b/src/logic_app.sh @@ -56,3 +56,17 @@ startup_debug() { msgdebug "Debug logging enabled - see: $DEBUG_LOG_FILE" fi } + +do_restart() { + msgnote "Restarting containers..." + uninstall_containers + install_containers + msgok "Restarted" +} + +do_update_ns() { + msgnote "Updating Nightscout and Mongo containers (downloading latest images)..." + uninstall_containers + update_containers + msgok "Updated" +} \ No newline at end of file diff --git a/src/logic_cleanup.sh b/src/logic_cleanup.sh index 33e0eb8..fcba3d8 100644 --- a/src/logic_cleanup.sh +++ b/src/logic_cleanup.sh @@ -95,6 +95,5 @@ do_cleanup_all() { do_cleanup_sys do_cleanup_docker do_cleanup_db - do_cleanup_diagnostics cleanup_stats }