mostly filebased Content Presentation System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.3KB

  1. #!/bin/bash
  2. USER=user
  3. SERVER=host.example.com
  4. LIVE_DIR=path/to/example.com/
  5. DEV_DIR=path/to/dev.example.com/
  6. CONTENT=content/
  7. ERROR="Error. Please make sure you've indicated correct parameters"
  8. if [ $# -eq 0 ]
  9. then
  10. echo $ERROR;
  11. exit 1
  12. elif [ $1 == "dev" ]
  13. then
  14. DIR=$DEV_DIR
  15. elif [ $1 == "live" ]
  16. then
  17. DIR=$LIVE_DIR
  18. else
  19. echo $ERROR
  20. exit 1
  21. fi
  22. if [[ -z $2 ]]
  23. then
  24. echo "Running App Sync (dry-run)"
  25. rsync --dry-run -az --force --delete --progress --exclude-from=.rsyncignore ./ $USER@$SERVER:$DIR;
  26. elif [[ $2 == "ssh" ]]
  27. then
  28. echo "entering server"
  29. ssh -t $USER@$SERVER "cd $LIVE_DIR; bash --login";
  30. elif [[ $2 == "go" ]]
  31. then
  32. echo "Running App Sync"
  33. rsync -az --force --delete --progress --exclude-from=.rsyncignore ./ $USER@$SERVER:$DIR;
  34. elif [[ $2 == "content" ]]
  35. then
  36. if [[ -z $3 ]]
  37. then
  38. echo "Fetching Content (dry-run)"
  39. rsync --dry-run -azv --force --delete --progress --exclude-from=.rsyncignore $USER@$SERVER:$DIR$CONTENT ./$CONTENT;
  40. echo "done"
  41. elif [[ $3 == "go" ]]
  42. then
  43. echo "Fetching Content"
  44. rsync -azv --force --delete --progress --exclude-from=.rsyncignore $USER@$SERVER:$DIR$CONTENT ./$CONTENT;
  45. echo "done"
  46. elif [[ $3 == "up" ]]
  47. then
  48. if [[ -z $4 ]]
  49. then
  50. echo "Uploading Content (dry-run)"
  51. rsync --dry-run -azv --progress --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT;
  52. echo "done"
  53. elif [[ $4 == "go" ]]
  54. then
  55. echo "Uploading Content"
  56. rsync -azv --progress --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT;
  57. echo "done"
  58. elif [[ $4 == "del" ]]
  59. then
  60. if [[ -z $5 ]]
  61. then
  62. echo "Uploading Content, deleting remotes that don't occur locally (dry-run)"
  63. rsync --dry-run -azv --progress --delete --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT;
  64. echo "done"
  65. elif [[ $5 == "go" ]]
  66. then
  67. echo "Uploading Content, deleting remotes that don't occur locally"
  68. rsync -azv --progress --delete --exclude-from=.rsyncignore ./$CONTENT $USER@$SERVER:$DIR$CONTENT;
  69. echo "done"
  70. fi
  71. fi
  72. fi
  73. fi