Guest User

Untitled

a guest
Nov 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. - name: start the app
  2. script: ../files/common/pm2.sh app_name {{ user }}
  3. tags: test
  4.  
  5. #!/bin/bash
  6. APP_NAME=$1
  7. USER=$2
  8.  
  9. if [ "$USER" != "" ]; then
  10. PATH="/home/$USER/"
  11. else
  12. PATH="/var/www/"
  13. fi
  14.  
  15. pm2 describe ${APP_NAME} > /dev/null # line no 11
  16. RUNNING=$?
  17.  
  18. if [ "${RUNNING}" -ne 0 ]; then
  19. cd ${PATH}${APP_NAME}/ && pm2 start npm --name "${APP_NAME}" -- start
  20. else
  21. pm2 restart ${APP_NAME}
  22. fi;
Add Comment
Please, Sign In to add comment