Last active
August 13, 2017 16:23
-
-
Save bolmaster2/838581 to your computer and use it in GitHub Desktop.
Deploy script using rsync and ssh to upload your local files
This file contains 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
#!/bin/sh | |
# server settings | |
SERVER="user@server.com" | |
SERVER_PATH="/var/www/project" | |
SSH_PORT="2222" | |
# sync with some standard exclude paths | |
rsync -rav -e "ssh -p $SSH_PORT" \ | |
--exclude='*.git' \ | |
--exclude="deploy.sh" \ | |
--exclude="node_modules" \ | |
. $SERVER:$SERVER_PATH/ | |
# restart app (passenger style) | |
# ssh $SERVER -p $SSH_PORT "mkdir $SERVER_PATH/tmp; touch $SERVER_PATH/tmp/restart.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! I would just add as improvement option --relative to create the project's folder in case it does not exist in case it is the first time