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

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment