#!/bin/sh
PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin
ISO_TIMESTAMP=`date +"%Y-%m-%dT%H:%M:%S"`

# This script backups local source folder to remote timestamped target folder.
# Please change the variables in step (1) first before running the script.

# (1) set up all backup varables
COMMANDER_HOME=/path/to/crossftp-all-bin
SOURCE_DIR=/path/to/source/dir
TARGET_SITE_ID=ID
TARGET_DIR=/path/to/target/dir.$ISO_TIMESTAMP

# (2) start backup
echo "Backup ${SOURCE_DIR} to remote folder ${TARGET_DIR}"

cd $COMMANDER_HOME && ./commander.sh --action copy --sourceSite MyComputer --sourceDir $SOURCE_DIR --targetSite $TARGET_SITE_ID --targetDir $TARGET_DIR

# (3) show user the result
echo "Finished backup ${SOURCE_DIR} to remote folder ${TARGET_DIR}"
