Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export NCURSES_NO_UTF8_ACS=1
- HEIGHT=20
- WIDTH=90
- CHOICE_HEIGHT=15
- BACKTITLE="Magento 2.3.0"
- TITLE="MENU"
- MENU="Escolha uma das opcoes:"
- binario="/usr/bin/php /var/www/html/magento2/bin/magento"
- systemctl="/bin/systemctl"
- sql="/usr/bin/mysql"
- OPTIONS=(show "Exibe current application mode"
- prod "Configura application mode: production"
- dev "Configura application mode: developer"
- cache "Realiza cache:flush e cache:clean"
- restart "Restart servicos apache2 varnish redis mysql"
- sql "Conta quantidade de linhas na tabela cron_schedule"
- perm "Corrige permissoes no diretorio /var/www/html/magento2"
- conf "Exibe todas configuracoes"
- setconf "Realiza alteracao nas configuracoes"
- deploy "Exclui arquivos static e cache / cache / deploy / permissions"
- clean "Exclui manualmente arquivos static e cache")
- CHOICE=$(dialog --clear \
- --backtitle "$BACKTITLE" \
- --title "$TITLE" \
- --menu "$MENU" \
- $HEIGHT $WIDTH $CHOICE_HEIGHT \
- "${OPTIONS[@]}" \
- 2>&1 >/dev/tty)
- clear
- case $CHOICE in
- show)
- echo -e "\033[44;1;37m Exibe current application mode\033[0m"
- $binario deploy:mode:show
- ;;
- prod)
- echo -e "\033[44;1;37m Alterando para production mode\033[0m"
- $binario deploy:mode:set production
- ;;
- dev)
- echo -e "\033[44;1;37m Alterando para developer mode\033[0m"
- $binario deploy:mode:set developer
- ;;
- cache)
- echo -e "\033[44;1;37m Realizando cache:flush\033[0m"
- $binario cache:flush
- echo -e "\033[44;1;37m Realizando cache:clean\033[0m"
- $binario cache:clean
- ;;
- restart)
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Nginx
- $systemctl restart nginx
- echo -e " \033[42;1;37m[OK]\033[0m" Restart PHP7.2-FPM
- $systemctl restart php7.2-fpm
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Varnish
- $systemctl restart varnish
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Redis
- $systemctl restart redis-server
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Mysql
- $systemctl restart mysql
- ;;
- sql)
- echo -e "\033[44;1;37m Resultado do select\033[0m"
- $sql -u USERMYSQL -p'PASSMYSQL' -e 'select count(*) from cron_schedule;' magento
- ;;
- perm)
- echo -e "\033[44;1;37m Corrigindo as permissoes diretorio/arquivos\033[0m"
- cd /var/www/html/magento2
- echo "[*] Alterando user:group"
- chown www-data:www-data -R *
- echo "[*] Alterando permissao arquivos para 644"
- find . -type f -exec chmod 644 {} \;
- echo "[*] Alterando permissao diretorios para 755"
- find . -type d -exec chmod 755 {} \;
- echo "[*] Permissao 777 /var"
- find ./var -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 diretorios /pub/media"
- find ./pub/media -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 diretorios /pub/static"
- find ./pub/static -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 /app/etc"
- chmod 777 ./app/etc
- echo "[*] Permissao 644 para todos xml em /app/etc"
- chmod 644 ./app/etc/*.xml
- echo "[*] Permissão 777 para diretorio /generated"
- chmod 777 ./generated
- ;;
- conf)
- echo -e "\033[44;1;37m Exibindo configuracoes\033[0m"
- $binario config:show
- ;;
- setconf)
- PARAM=$(dialog --stdout --inputbox 'Digite <parametro> <1/0>' 0 0)
- clear
- echo -e "\033[44;1;37m Alterando parametro\033[0m"
- $binario config:set $PARAM
- ;;
- deploy)
- echo -e "\033[44;1;37m Excluindo arquivos cache e static\033[0m"
- echo -e "[*] Excluindo arquivos diretorio /var/view_preprocessed/*"
- rm -rf /var/www/html/magento2/var/view_preprocessed/*
- echo -e "[*] Excluindo arquivos diretorio /var/page_cache/*"
- rm -rf /var/www/html/magento2/var/page_cache/*
- echo -e "[*] Excluindo arquivos diretorio /pub/static/*"
- rm -rf /var/www/html/magento2/pub/static/*
- echo -e "[*] Excluindo arquivos diretorio /var/cache/*"
- rm -rf /var/www/html/magento2/var/cache/*
- echo -e "\033[44;1;37m Realizando cache:flush\033[0m"
- $binario cache:flush
- echo -e " "
- echo -e "\033[44;1;37m Realizando cache:clean\033[0m"
- $binario cache:clean
- echo -e " "
- echo -e "\033[44;1;37m Realizando deploy\033[0m"
- $binario setup:static-content:deploy
- echo -e " "
- echo -e "\033[44;1;37m Corrigindo as permissoes diretorio/arquivos\033[0m"
- cd /var/www/html/magento2
- echo "[*] Alterando user:group"
- chown www-data:www-data -R *
- echo "[*] Alterando permissao arquivos para 644"
- find . -type f -exec chmod 644 {} \;
- echo "[*] Alterando permissao diretorios para 755"
- find . -type d -exec chmod 755 {} \;
- echo "[*] Permissao 777 /var"
- find ./var -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 diretorios /pub/media"
- find ./pub/media -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 diretorios /pub/static"
- find ./pub/static -type d -exec chmod 777 {} \;
- echo "[*] Permissao 777 /app/etc"
- chmod 777 ./app/etc
- echo "[*] Permissao 644 para todos xml em /app/etc"
- chmod 644 ./app/etc/*.xml
- echo "[*] Permissão 777 para diretorio /generated"
- chmod 777 ./generated
- echo -e " "
- echo -e "\033[44;1;37m Restart servicos\033[0m"
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Apache2
- $systemctl restart apache2
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Varnish
- $systemctl restart varnish
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Redis
- $systemctl restart redis-server
- echo -e " \033[42;1;37m[OK]\033[0m" Restart Mysql
- $systemctl restart mysql
- ;;
- clean)
- echo -e "\033[44;1;37m Excluir manualmente arquivos static e cache\033[0m"
- echo -e "[*] Excluindo arquivos diretorio /var/view_preprocessed/*"
- rm -rf /var/www/html/magento2/var/view_preprocessed/*
- echo -e "[*] Excluindo arquivos diretorio /var/page_cache/*"
- rm -rf /var/www/html/magento2/var/page_cache/*
- echo -e "[*] Excluindo arquivos diretorio /pub/static/*"
- rm -rf /var/www/html/magento2/pub/static/*
- echo -e "[*] Excluindo arquivos diretorio /var/cache/*"
- rm -rf /var/www/html/magento2/var/cache/*
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement