Files
herolib/examples/sync_do.sh
2025-09-24 21:06:37 +04:00

24 lines
734 B
Bash
Executable File

#!/bin/bash
# SSH and rsync configuration
SSH_HOST="verse.tf"
SSH_USER="root"
SOURCE_DIR="${HOME}/code/github/incubaid/herolib/"
DEST_DIR="/root/code/github/incubaid/herolib/"
FINAL_DIR="/root/code/github/incubaid/herolib/examples/hero"
# Check if the source directory exists, if not stop
if [ ! -d "$SOURCE_DIR" ]; then
echo "Source directory $SOURCE_DIR does not exist. Exiting."
exit 1
fi
# Perform rsync over SSH, ignoring .git directory
#--exclude '.git' --exclude '.venv'
rsync -avz --delete -e ssh "$SOURCE_DIR/" "$SSH_USER@$SSH_HOST:$DEST_DIR/"
set -x
# SSH into the remote machine and change to the specified directory
ssh -At root@verse.tf "tmux attach-session -t main || tmux new-session -s main -c ${FINAL_DIR}"