Skip to content

Instantly share code, notes, and snippets.

@amityweb
Last active April 16, 2024 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amityweb/da8c5d7da9d043901ad10f69d7bed73e to your computer and use it in GitHub Desktop.
Save amityweb/da8c5d7da9d043901ad10f69d7bed73e to your computer and use it in GitHub Desktop.
Rclone command to run from Amity Servers
#!/bin/bash
ps_out=`ps -ef | grep "rclone sync\|bash rclone" | grep -v 'grep'`
result=$(echo $ps_out | grep "$1")
if [ "$result" = "" ];then
# DB Dumps First
#for i in $(mysql --batch --skip-column-names -e 'SHOW DATABASES' | egrep -v 'performance_schema|information_schema|mysql|eximstats|leechprotect|cphulkd|modsec|roundcube|logaholicDB_.'); do mysqldump --single-transaction -h localhost --opt $i | gzip -c > /home/_dbbackups/$i.sql.gz; done
# Home Folder Dump
DATE=$(date +%Y-%m-%d.%H:00)
SOURCE="/home/"
TARGET="Mega:Backups/$1"
LATESTFOLDER="$TARGET/latest"
INCFOLDER="$TARGET/inc/$DATE"
/usr/bin/rclone sync --verbose --skip-links --no-update-modtime --transfers=5 --checkers=4 --tpslimit=5 --tpslimit-burst 5 --max-backlog 200000 --exclude "_tbd/**" --exclude "_bkp/**" --exclude=".DS_Store" --exclude "ssl.*" --exclude "etc/**" --exclude "fcgi-bin/**" --exclude "cgi-bin/**" --exclude "logs/**" --exclude "tmp/**" --exclude "Maildir/**" --exclude "cache/**" $SOURCE $LATESTFOLDER --backup-dir=$INCFOLDER
else
echo "Rclone is already Running."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment