Last active
July 4, 2017 05:56
-
-
Save kamerk22/b39f4e0ec1b01205505d60f0c596e655 to your computer and use it in GitHub Desktop.
Automatic pm2 deploy bash script run on production server as well as development server.
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/bash | |
#Author: Kashyap Merai | [email protected] | |
# Variables | |
ch_1="pm2 Production Setup." | |
ch_2="pm2 Production Update." | |
ch_3="pm2 Production." | |
ch_4="pm2 Development Setup." | |
ch_5="pm2 Development." | |
curr_dir=`pwd` | |
tar_dir='/var/www/deployProcess/' | |
echo "Welcome `whoami`!" | |
echo `date` | |
echo -e "\n" | |
echo "===========================" | |
echo " pm2 Manager" | |
echo "===========================" | |
echo "(1) : "$ch_1 | |
echo "(2) : "$ch_2 | |
echo "(3) : "$ch_3 | |
echo "(4) : "$ch_4 | |
echo "(5) : "$ch_5 | |
echo "---------------------------" | |
echo -e "By Kashyap Merai | [email protected] \n" | |
read -p "Please Enter Your Choice : " choice | |
echo -e "\n" | |
cd $tar_dir | |
case $choice in | |
1) | |
echo "["`date +%T`"]"" Currently Running : "$ch_1 | |
echo "Current DIR : "$curr_dir | |
echo "Target DIR : "$tar_dir | |
echo `pm2 deploy ecosystem.json production setup` | |
;; | |
2) | |
echo "["`date +%T`"]"" Currently Running : "$ch_2 | |
echo "Current DIR : "$curr_dir | |
echo "Target DIR : "$tar_dir | |
echo `pm2 deploy ecosystem.json production update` | |
;; | |
3) | |
echo "["`date +%T`"]"" Currently Running : "$ch_3 | |
echo "Current DIR : "$curr_dir | |
echo "Target DIR : "$tar_dir | |
echo `pm2 deploy ecosystem.json production` | |
;; | |
4) | |
echo "["`date +%T`"]"" Currently Running : "$ch_4 | |
echo "Current DIR : "$curr_dir | |
echo "Target DIR : "$tar_dir | |
echo `pm2 deploy ecosystemdev.json development setup` | |
;; | |
5) | |
echo "["`date +%T`"]"" Currently Running : "$ch_5 | |
echo "Current DIR : "$curr_dir | |
echo "Target DIR : "$tar_dir | |
echo `pm2 deploy ecosystemdev.json development` | |
;; | |
*) | |
echo "That's where you wrong kiddo!" | |
;; | |
esac | |
cd $curr_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment