#!/bin/bash
cd /home/icodex/Dev_Peer-reviewr/pr-reviewr
current_date=$(date +"%d-%m-%Y")/$(date +"%H-%M-%S")
sudo -S mkdir -p /home/icodex/Dev_Peer-reviewr/Rollback/pr-reviewr-Service/"$current_date" < /home/icodex/deployment_Scrips/passwd
sudo -S cp -rf /home/icodex/Dev_Peer-reviewr/pr-reviewr/* /home/icodex/Dev_Peer-reviewr/Rollback/pr-reviewr-Servicer/"$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/r2/a/_iCapp-ReviewerOne-service-CI/drop/Icodex.Peerreview.Myprofile
sudo -S rsync -av --exclude='appsettings.json' --exclude='runtimes' ./ /home/icodex/Dev_Peer-reviewr/pr-reviewr/ < /home/icodex/deployment_Scrips/passwd
sudo -S systemctl restart DEV-pr-reviewr.service < /home/icodex/deployment_Scrips/passwd
 
