Riyyi

syncwebsite.sh

Aug 13th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. DIRECTORIES=\
  4. "app
  5. public"
  6.  
  7. SOURCE="."
  8. DESTINATION="<user>@<ip>:/destination/home/<user>"
  9.  
  10. cd "<path/to/sourcecode>" || exit
  11.  
  12. # Directory syncing
  13. for DIR in $DIRECTORIES; do
  14. cd "$DIR" || exit
  15. rsync -avrP --delete-after --rsh='ssh -p <portnumber>' \
  16. --exclude="media" \
  17. "$SOURCE" "$DESTINATION/$DIR" 2>&1 > /dev/null
  18. cd ..
  19. done
  20.  
  21. # File syncing
  22. rsync -avP --rsh='ssh -p <portnumber>' \
  23. --include="config.php" \
  24. --include="route.php" \
  25. --exclude="*" \
  26. "$SOURCE" "$DESTINATION" 2>&1 > /dev/null
  27.  
  28. echo "Synced all files to remote."
Advertisement
Add Comment
Please, Sign In to add comment