Created
June 4, 2019 19:21
-
-
Save jfcherng/955ed2bb8d0ac42197b85fe5740d2c2b to your computer and use it in GitHub Desktop.
rsync ssh example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:${PATH} | |
SERVER_IP="0.0.0.0" | |
SERVER_PORT="22" | |
SYNC_DIRS=( | |
# MySQL | |
"/usr/local/mysql/bin" | |
"/usr/local/mysql/lib" | |
# NGINX | |
"/usr/local/nginx/sbin" | |
# Redis | |
"/usr/local/redis/bin" | |
# PHP 7.4 | |
"/usr/local/php74/bin" | |
"/usr/local/php74/sbin" | |
"/usr/local/php74/lib" | |
# ImageMagick | |
"/usr/local/imagemagick" | |
) | |
for src_dir in "${SYNC_DIRS[@]}"; do | |
dest_dir=$(dirname "${src_dir}") | |
rsync -av --delete -e "ssh -p ${SERVER_PORT}" "root@${SERVER_IP}:${src_dir}" "${dest_dir}" | |
done | |
ldconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment