Skip to content

Instantly share code, notes, and snippets.

@bolmaster2
Last active August 13, 2017 16:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bolmaster2/838581 to your computer and use it in GitHub Desktop.
Save bolmaster2/838581 to your computer and use it in GitHub Desktop.
Deploy script using rsync and ssh to upload your local files
#!/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"
@beldog
Copy link

beldog commented Aug 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment