node-hook/scripts/application_start.sh
aliaksei-kudravets d975c45292 simple app
2021-06-08 15:18:32 +02:00

18 lines
590 B
Bash

#!/bin/bash
#give permission for everything in the express-app directory
sudo chmod -R 777 /home/test-hook/express-app
#navigate into our working directory where we have all our github files
cd /home/test-hook/express-app
#add npm and node to path
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # loads nvm bash_completion (node is in path now)
#install node modules
npm install
#start our node app in the background
node app.js > app.out.log 2> app.err.log < /dev/null &