Fix rclone sync script
This commit is contained in:
parent
2fceb0c6bd
commit
2a2ee511f3
1 changed files with 12 additions and 4 deletions
|
@ -1,11 +1,19 @@
|
|||
#!/bin/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:"
|
||||
|
||||
# Log file path
|
||||
LOGFILE="$HOME/rclone-sync.log"
|
||||
# Create timestamped log file
|
||||
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
LOGFILE="$HOME/logs/rclone-sync-$TIMESTAMP.log"
|
||||
|
||||
# Run rclone sync and log output to both stdout and file
|
||||
/usr/bin/rclone sync "$SOURCE" "$DEST" --log-level=INFO 2>&1 | tee -a "$LOGFILE"
|
||||
# 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