imporved
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
This is the Rsync Setup Guide
|
||||
This guide is a work in progress
|
||||
|
||||
|
||||
First git Repository need installed at /mnt/user/appdata/unraid_scripts/
|
||||
Then made executable, copy and paste contents of git_pull_execute.sh script to a new script in unRAID User Scripts
|
||||
|
||||
in unRAID User Scripts, to use scripts in git
|
||||
Create a new Script and name it whatever
|
||||
You can copy contents of user_script_pluin.sh and paste then change acordingly
|
||||
or
|
||||
add a line pointing to script plus local folder to be synced
|
||||
Exampl = /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/
|
||||
|
||||
This opens the script and passes the folder overas an argument
|
||||
This allows for multiple rsync ops running off a single core script
|
||||
|
||||
All changes made to 1 single core script then works for all user scripts that point to rsync.sh
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# -----------------------------
|
||||
# Configurable variables
|
||||
# -----------------------------
|
||||
REPO_SSH="git@192.168.50.2:FailedProxy/Unraid_Scripts.git"
|
||||
TARGET_DIR="/mnt/user/appdata/unraid_scripts"
|
||||
SSH_KEY="/root/.ssh/id_gitea_rsync"
|
||||
SSH_PORT=221
|
||||
|
||||
# -----------------------------
|
||||
# Create target directory if it doesn't exist
|
||||
# -----------------------------
|
||||
mkdir -p "$TARGET_DIR"
|
||||
cd "$TARGET_DIR"
|
||||
|
||||
# -----------------------------
|
||||
# Clone or pull repo (discard local changes)
|
||||
# -----------------------------
|
||||
if [ -d ".git" ]; then
|
||||
echo "Repository already exists. Resetting local changes and pulling latest..."
|
||||
git reset --hard
|
||||
git clean -fd
|
||||
GIT_SSH_COMMAND="ssh -i $SSH_KEY -p $SSH_PORT" git pull
|
||||
else
|
||||
echo "Cloning $REPO_SSH into $TARGET_DIR..."
|
||||
GIT_SSH_COMMAND="ssh -i $SSH_KEY -p $SSH_PORT" git clone "$REPO_SSH" .
|
||||
fi
|
||||
|
||||
# -----------------------------
|
||||
# Ensure scripts are executable
|
||||
# -----------------------------
|
||||
echo "Setting executable permissions on scripts..."
|
||||
find "$TARGET_DIR" -type f -name "*.sh" -exec chmod +x {} \;
|
||||
|
||||
echo "Repository is up to date and scripts are executable."
|
||||
+4
-3
@@ -3,6 +3,7 @@ set -e
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#----------------- User Variables, Please adjust in Master.cong as needed ----------------------
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
# This is the main Core Rsync script
|
||||
#
|
||||
# User vaiables can be adjusted in Master.conf
|
||||
# scripts now just contain runtime codes
|
||||
@@ -10,10 +11,10 @@ set -e
|
||||
# This allows for profiles and multiple things to use the core script
|
||||
# use arguments in unRAID User Plugin for directory
|
||||
# Example = /mnt/user/appdata/unraid_scripts/Rsync/rsync.sh
|
||||
# /mnt/user/appdata-Failover/Arrs_Stack/
|
||||
# /mnt/user/appdata-test/Arrs/
|
||||
#
|
||||
# /mnt/user/appdata-Failover/Arrs_Stack/ is the argument
|
||||
# If the last name /Arrs-Stack/ matches a profile in Master.conf then profiles are used
|
||||
# /mnt/user/appdata-test/Arrs/ is the argument
|
||||
# If the last name /Arrs/ matches a profile in Master.conf then profiles are used
|
||||
# If no matches then Global Configureation is used in Master.conf
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
!/bin/bash
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#------------------------------------- Rsync command -------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
|
||||
/mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/
|
||||
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#-------------------------------------------- Info ---------------------------------------------
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#
|
||||
# These global configuartions can be added as arguments at the end of the script after folder location
|
||||
# Its better to add profile in Master.conf for perm changes
|
||||
# Profiles in Master.conf match the last string of folder location
|
||||
# if a match is made with a list in Master.conf then the associated profile will be used
|
||||
# If no match is made it defualts to global defualts
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#----------------- User Variables, Please adjust in Master.cong as needed ----------------------
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Does a dry run making no changes
|
||||
#--dry-run
|
||||
#
|
||||
# Network speed limit (KB/s)
|
||||
#BW_LIMIT=12500
|
||||
#
|
||||
# Retry logic
|
||||
#RETRY_COUNT=3
|
||||
#
|
||||
# Sleep between retries (seconds)
|
||||
#SLEEP=300
|
||||
#
|
||||
# Max number of concurrently running rsync processes
|
||||
#MAX_RSYNC_PROCS=1
|
||||
#
|
||||
# Container start/stop/restart before and after rsync
|
||||
#CRITICAL_CONTAINER_NAMES=()
|
||||
#
|
||||
# Containers that need delayed before starting
|
||||
#DELAYED_CONTAINERS=()
|
||||
#
|
||||
# Delay in seconds between starting containers, useful for things like Authelia
|
||||
#CONTAINER_DELAY=5
|
||||
#
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#---------------End Of User Variables, Please adjust in Master.cong as needed ------------------
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
#
|
||||
#Examples
|
||||
#/mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/ MAX_RSYNC_PROCS=2
|
||||
#/mnt/user/appdata/unraid_scripts/Rsync/rsync.sh /mnt/user/appdata-test/Arrs/ --dry-run MAX_RSYNC_PROCS=2
|
||||
Reference in New Issue
Block a user