-->

shell scipt git code deploy on linux

#!/bin/bash

cd  /home/ubuntu/code-deploy/php-code/

date >> /home/ubuntu/code-deploy/gitpull

git pull >> /home/ubuntu/code-deploy/gitpull 2>&1

echo "----------------" >> /home/ubuntu/code-deploy/gitpull

echo "Type 1 for stage"

echo "Type 2 for prod"

echo ""

read -p "Type your value: " Env

echo $Env


if [ $Env -eq 1 ];

then

        /usr/bin/rsync --delete -avrz --no-perms --no-owner --no-group --exclude 'config' --exclude 'images' --exclude 'logs' --exclude 'uploads' /home/ubuntu/code-deploy/php-code/  /var/www/html/

        echo ""

        echo "Code deployed on Stage environment....."

elif [ $Env -eq 2 ];

then

        echo "Prod is not setup"

else

        echo "Invalid Value"

fi