diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 3049fcc..c41d31f 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -420,23 +420,63 @@ } alias_vim: alias vi=vim alias_here: alias here='ls -alh `pwd`/*' - alias_docker_reload: | - alias docker-reload=' + function_docker_reload: | + function docker-reload() { + if [[ "$1" == "-h" || "$1" == "--help" ]]; then + cat <<- EOF + Usage: docker-reload [container_name] + Providing the container name starts a log follow after the command. + A reload is characterized by a DOWN, BUILD, and UP. + EOF + return 0 + fi + docker compose down && docker compose build && docker compose up -d - ' - alias_docker_update: | - alias docker-update=' + + if [[ -n "$1" ]]; then + docker logs -f $1 + fi + + return 0 + } + function_docker_update: | + function docker-update() { + if [[ "$1" == "-h" || "$1" == "--help" ]]; then + cat <<- EOF + Usage: docker-update [container_name] + Providing the container name starts a log follow after the command. + An update is characterized by a DOWN, PULL, BUILD, and UP. + EOF + return 0 + fi + docker compose down && docker compose pull && docker compose build && docker compose up -d - ' + + if [[ -n "$1" ]]; then + docker logs -f $1 + fi + + return 0 + } function_docker_upgrade: | function docker-upgrade() { # Wrapper for a full-scale upgrade and log view of a container. - # Paramaters: + + if [[ "$1" == "-h" || "$1" == "--help" ]]; then + cat <<- EOF + Usage: docker-upgrade [container_name] + Providing the container name starts a log follow after the command. + An upgrade is characterized by a DOWN, PULL, BUILD, and UP. + EOF + return 0 + fi + + # Parameters: # 1) Container ID or Container Name, as seen in 'docker ps' command. container=$1 if [[ -z $container ]]; then @@ -466,9 +506,29 @@ echo "*** Following Log ***" && echo "Press ^C to escape." && docker logs -f $container + + return 0 + } + function_docker_restart: | + function docker-restart() { + if [[ "$1" == "-h" || "$1" == "--help" ]]; then + cat <<- EOF + Usage: docker-restart [container_name] + Providing the container name starts a log follow after the command. + A restart is characterized by a DOWN and UP. + EOF + return 0 + fi + + docker compose down && + docker compose up -d + + if [[ -n "$1" ]]; then + docker logs -f $1 + fi + + return 0 } - alias_docker_restart: | - alias docker-restart='docker compose down && docker compose up -d' alias_code_check: | alias code-check=' echo "Checking ~/Code directory for git changes." @@ -703,10 +763,10 @@ {{ function_flatpak_purge }} {{ alias_vim }} {{ alias_here }} - {{ alias_docker_reload }} - {{ alias_docker_update }} + {{ function_docker_reload }} + {{ function_docker_update }} {{ function_docker_upgrade }} - {{ alias_docker_restart }} + {{ function_docker_restart }} {{ alias_code_check }} {{ alias_code_reset }} {{ function_code_reseed }}