Skip to content

Instantly share code, notes, and snippets.

@vanduc1102
Created January 15, 2020 12:37
Show Gist options
  • Save vanduc1102/1da4e6a953f4468d9ebecf6d5121c76f to your computer and use it in GitHub Desktop.
Save vanduc1102/1da4e6a953f4468d9ebecf6d5121c76f to your computer and use it in GitHub Desktop.
checkout code and reload nodejs server
#!/bin/sh
# It is good practice to print the required versions on server.
# cause the code will execute in SSH non interactively mode.
# https://stackoverflow.com/questions/17089808/how-to-do-remote-ssh-non-interactively
echo "NodeJS: "$(node -v)
echo "NPM: "$(npm -v)
WORKSPACE=/working_directory/public_html
echo "Working directory: " $WORKSPACE
cd $WORKSPACE
git checkout develop -f
echo "===================Install dependencies ==========="
npm install
echo "===================Finished install dependencies ========"
echo "RELOAD ENV"
pm2 reload $WORKSPACE/ecosystem.config.js --env production --update-env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment