Created
August 14, 2022 21:31
-
-
Save drowsy-probius/2dd953e1e4e0cc1c0758835ea6f012d3 to your computer and use it in GitHub Desktop.
rclone move script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 이미 이 스크립트가 실행 중이라면 새로 실행하지 않음. | |
if pidof -o %PPID -x "$0"; then | |
exit 1 | |
fi | |
####### | |
# 아래 값에서 쌍따옴표 내부 값만 수정하는걸 권장함 | |
# 구글드라이브 특화 스크립트임. | |
# | |
# 로그 파일 남길 위치. 로그 남기지 않으려면 값을 /dev/null으로 하면 될 듯? | |
LOGFILE="/your/directory/upload_twitch.log" | |
# 업로드 될 로컬 폴더 | |
BASEDIR="/your/local/directory" | |
# rclone으로 설정한 원격 폴더 | |
DESTDIR="rclone_remote:path/to/upload" | |
# 이 만큼 지난 파일만 업로드. 대략적인 키워드는 아래에 있음 | |
# m: minutes, h: hours, d: days, w: weeks, M: months | |
AGE="2d" | |
# 업로드 대역폭 제한 | |
BANDWIDTH="7M" | |
# 구글드라이브는 일일 750G 업로드 제한이 있음. | |
MAX_TRANSFER="450G" | |
# 최대 실행 시간 | |
MAX_DURATION="7h" | |
####### | |
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED - $DIR" | tee -a $LOGFILE | |
rclone move $BASEDIR $DESTDIR \ | |
--exclude "#recycle/" \ | |
--exclude "@eaDir/**" \ | |
--exclude "$RECYCLE.BIN/**" \ | |
--min-age $AGE \ | |
--bwlimit $BANDWIDTH \ | |
--transfers=1 \ | |
--max-transfer $MAX_TRANSFER \ | |
--max-duration $MAX_DURATION \ | |
--cutoff-mode soft \ | |
--drive-stop-on-upload-limit \ | |
--create-empty-src-dirs \ | |
--delete-empty-src-dirs \ | |
--log-level INFO \ | |
--stats=5m \ | |
--stats-one-line \ | |
--log-file=$LOGFILE | |
echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD FINISHED IN $(($(date +'%s') - $start)) SECONDS - $DIR" | tee -a $LOGFILE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment