add seed timer & re-org
This commit is contained in:
parent
a3cd2f0fdd
commit
563ad690c2
9 changed files with 131 additions and 0 deletions
26
scripts/bash/rclone-sync.sh
Executable file
26
scripts/bash/rclone-sync.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Set timezone to US Eastern (handles both EST and EDT correctly)
|
||||
export TZ="America/New_York"
|
||||
|
||||
# Define source and destination
|
||||
SOURCE="$HOME/files/media"
|
||||
DEST="goji-hetzner:"
|
||||
|
||||
# Create timestamped log file
|
||||
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
LOGFILE="$HOME/logs/rclone-sync-$TIMESTAMP.log"
|
||||
LOCKFILE="/tmp/rclone-sync.lock"
|
||||
|
||||
exec 9>"$LOCKFILE"
|
||||
if ! flock -n 9; then
|
||||
echo "rclone sync is already running. exiting...." | tee "$LOGFILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run rclone and log output to both screen and file using tee (no --log-file!)
|
||||
{
|
||||
echo "=== rclone sync started at $(date) ==="
|
||||
/usr/bin/rclone sync "$SOURCE" "$DEST" --log-level=INFO
|
||||
echo "=== rclone sync finished at $(date) ==="
|
||||
} 2>&1 | tee "$LOGFILE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue