Advertisement
Inverth

bash

Jul 1st, 2022
755
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.83 KB | None
  1. cd /var/www
  2. PS1="\n\e[31m┌[\\u][\T]> \w\n└\e[0m"
  3.  
  4.  
  5. function printDockerContainers() {
  6.     if $# == 0;
  7.     then
  8.         sudo docker ps -a;
  9.     else
  10.         sudo docker ps -a --filter "name=$1";
  11.     fi
  12. }
  13.  
  14. function printDockerContainerLogs() {
  15.     sudo docker logs -n $2 $1
  16. }
  17.  
  18. function execCommandInContainer() {
  19.     sudo docker exec -ti $1 $2;
  20. }
  21.  
  22. function cpFileToContainer() {
  23.     sudo docker cp $2 $1:/var/$2;
  24. }
  25.  
  26. function cacheClear() {
  27.     sudo docker exec -ti $1 bin/console cache:clear;
  28. }
  29.  
  30. function execMigrations() {
  31.     php7.4 /usr/local/bin/migrate/migrate.php $1 $2;
  32. }
  33.  
  34.  
  35. alias dc-ps="printDockerContainers"
  36. alias dc-exec="execCommandInContainer"
  37. alias dc-cp="cpFileToContainer"
  38. alias dc-cache-cls="cacheClear"
  39. alias dc-logs="printDockerContainerLogs"
  40. alias migrate="execMigrations"
  41. alias cls="clear"
Advertisement
RAW Paste Data Copied
Advertisement