#!/bin/bash
cd /home/icodex/QA_Peer-reviewr/InviteAndRefer
current_date=$(date +"%d-%m-%Y")/$(date +"%H-%M-%S")
sudo -S mkdir -p /home/icodex/QA_Peer-reviewr/Rollback/InviteAndRefer/"$current_date" < /home/icodex/deployment_Scrips/passwd
sudo -S cp -rf /home/icodex/QA_Peer-reviewr/InviteAndRefer/* /home/icodex/QA_Peer-reviewr/Rollback/InviteAndRefer-Service/"$current_date" < /home/icodex/deployment_Scrips/passwd
sudo -S  find . -type f -not -name 'appsettings.json' -exec rm -rf {} + < /home/icodex/deployment_Scrips/passwd
cd /home/icodex/azagent/_work/r6/a/_ReviewerOne-InviteAndRefer.NET Core-CI/drop/iCodex.PeerReview.InviteAndReffer
sudo -S rsync -av --exclude='appsettings.json' --exclude='runtimes' ./ /home/icodex/QA_Peer-reviewr/InviteAndRefer/ < /home/icodex/deployment_Scrips/passwd
sudo -S systemctl restart QA-InviteAndRefer.service < /home/icodex/deployment_Scrips/passwd

