From 2c930604e40910e6f5ca1cdb73fdf5c208c020af Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 29 Apr 2019 22:11:00 -0500 Subject: [PATCH 01/66] update to latest version --- Dockerfile | 24 +++++++++++++++++------- LICENSE.md | 1 + README.md | 6 ++++-- entrypoint.sh | 37 ++++++++++++++++++++++++++++++++++--- sync.sh | 51 +++++++++++++++++++++++++++++++++++++-------------- 5 files changed, 93 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00e8723..7e26c7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,17 @@ -FROM alpine:3.5 +FROM alpine:3.9 -MAINTAINER Brian J. Cardiff +MAINTAINER pfidr -ENV RCLONE_VERSION=current -ENV ARCH=amd64 +ARG RCLONE_VERSION=current +ARG ARCH=amd64 ENV SYNC_SRC= ENV SYNC_DEST= ENV SYNC_OPTS=-v +ENV RCLONE_CMD=sync +ENV RCLONE_DIR_CMD=ls +ENV RCLONE_DIR_CHECK_SKIP= ENV RCLONE_OPTS="--config /config/rclone.conf" +ENV OUTPUT_LOG= ENV CRON= ENV CRON_ABORT= ENV FORCE_SYNC= @@ -15,9 +19,14 @@ ENV CHECK_URL= ENV TZ= RUN apk -U add ca-certificates fuse wget dcron tzdata \ - && rm -rf /var/cache/apk/* \ - && cd /tmp \ - && wget -q http://downloads.rclone.org/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip \ + && rm -rf /var/cache/apk/* + +RUN if [ "$RCLONE_VERSION" = "current" ] ; \ + then cd /tmp && wget -q http://downloads.rclone.org/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ + else cd /tmp && wget -q http://downloads.rclone.org/${RCLONE_VERSION}/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ + fi + +RUN cd /tmp \ && unzip /tmp/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip \ && mv /tmp/rclone-*-linux-${ARCH}/rclone /usr/bin \ && rm -r /tmp/rclone* @@ -27,6 +36,7 @@ COPY sync.sh / COPY sync-abort.sh / VOLUME ["/config"] +VOLUME ["/logs"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/LICENSE.md b/LICENSE.md index 43dd8a7..a2c16f2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,3 +1,4 @@ +Copyright 2019 Pfidr34 Copyright 2017 Brian J. Cardiff Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 67880ef..50589b0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # docker-rclone +**Credit to Brian J. Cardiff for the orginal project @ https://github.com/bcardiff/docker-rclone** + Docker image to perform a [rclone](http://rclone.org) sync based on a cron schedule, with [healthchecks.io](https://healthchecks.io) monitoring. rclone is a command line program to sync files and directories to and from: @@ -32,7 +34,7 @@ A first run of the container can help in the creation of the file, but feel free ``` $ mkdir config -$ docker run --rm -it -v $(pwd)/config:/config bcardiff/rclone +$ docker run --rm -it -v $(pwd)/config:/config pfidr34/rclone ``` ### Perform sync in a daily basis @@ -49,7 +51,7 @@ A few environment variables allow you to customize the behavior of the sync: * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Argentina/Buenos_Aires` ```bash -$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Argentina/Buenos_Aires" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid bcardiff/rclone +$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Argentina/Buenos_Aires" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr34/rclone ``` See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest syntax and additional options. diff --git a/entrypoint.sh b/entrypoint.sh index 3a7c5e7..076f0db 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,37 @@ set -e +# Announce version +echo "INFO: Running $(rclone --version | head -n 1)" + +# Make sure sync/copy command is ok +if [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "SYNC" ] && [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "COPY" ] +then + echo "WARNING: rclone command '$RCLONE_CMD' is not supported by this container, please use sync or copy. Stopping." + exit 1 +fi + +# Make sure dir command is ok +if [ "$(echo "$RCLONE_DIR_CMD" | tr '[:lower:]' '[:upper:]')" != "LS" ] && [ "$(echo "$RCLONE_DIR_CMD" | tr '[:lower:]' '[:upper:]')" != "LSF" ] +then + echo "WARNING: rclone directory command '$RCLONE_DIR_CMD' is not supported by this container, please use ls or lsf. Stopping." + exit 1 +fi + +# Re-write cron shortcut +case "$(echo "$CRON" | tr '[:lower:]' '[:upper:]')" in + *@YEARLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 1 1 *" && CRONS="0 0 1 1 *";; + *@ANNUALLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 1 1 *" && CRONS="0 0 1 1 *";; + *@MONTHLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 1 * *" && CRONS="0 0 1 * * ";; + *@WEEKLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 * * 0" && CRONS="0 0 * * 0";; + *@DAILY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 * * *" && CRONS="0 0 * * *";; + *@MIDNIGHT* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 * * *" && CRONS="0 0 * * *";; + *@HOURLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 * * * *" && CRONS="0 * * * *";; + *@* ) echo "WARNING: Cron shortcut $CRON is not supported. Stopping." && exit 1;; + * ) CRONS=$CRON;; +esac + +# Set time zone if passed in if [ ! -z "$TZ" ] then cp /usr/share/zoneinfo/$TZ /etc/localtime @@ -10,6 +41,7 @@ fi rm -f /tmp/sync.pid +# Check for source and destination ; launch config if missing if [ -z "$SYNC_SRC" ] || [ -z "$SYNC_DEST" ] then echo "INFO: No SYNC_SRC and SYNC_DEST found. Starting rclone config" @@ -18,7 +50,7 @@ then else # SYNC_SRC and SYNC_DEST setup # run sync either once or in cron depending on CRON - if [ -z "$CRON" ] + if [ -z "$CRONS" ] then echo "INFO: No CRON setting found. Running sync once." echo "INFO: Add CRON=\"0 0 * * *\" to perform sync every midnight" @@ -33,7 +65,7 @@ else # Setup cron schedule crontab -d - echo "$CRON /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp + echo "$CRONS /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp if [ -z "$CRON_ABORT" ] then echo "INFO: Add CRON_ABORT=\"0 6 * * *\" to cancel outstanding sync at 6am" @@ -52,4 +84,3 @@ else tail -F /tmp/crond.log /tmp/sync.log fi fi - diff --git a/sync.sh b/sync.sh index 1eca77c..f2e5b11 100755 --- a/sync.sh +++ b/sync.sh @@ -6,26 +6,49 @@ echo "INFO: Starting sync.sh pid $$ $(date)" if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] then - echo "WARNING: A previous sync is still running. Skipping new sync command." + echo "WARNING: A previous $RCLONE_CMD is still running. Skipping new $RCLONE_CMD command." else -echo $$ > /tmp/sync.pid + echo $$ > /tmp/sync.pid -if test "$(rclone ls $SYNC_SRC $RCLONE_OPTS)"; then - # the source directory is not empty - # it can be synced without clear data loss - echo "INFO: Starting rclone sync $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" - rclone sync $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS - - if [ -z "$CHECK_URL" ] + if [ ! -z "$RCLONE_DIR_CHECK_SKIP" ] then - echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor sync job" + echo "INFO: Skipping source directory check..." + if [ ! -z "$OUTPUT_LOG" ] + then + d=$(date +%Y_%m_%d-%H_%M_%S) + LOG_FILE="/logs/$d.txt" + echo "INFO: Log file output to $LOG_FILE" + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + else + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + fi else - wget $CHECK_URL -O /dev/null + if test "$(rclone $RCLONE_DIR_CMD $SYNC_SRC $RCLONE_OPTS)"; then + echo "INFO: Source directory is not empty and can be processed without clear loss of data" + if [ ! -z "$OUTPUT_LOG" ] + then + d=$(date +%Y_%m_%d-%H_%M_%S) + LOG_FILE="/logs/$d.txt" + echo "INFO: Log file output to $LOG_FILE" + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + else + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + fi + if [ -z "$CHECK_URL" ] + then + echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" + else + wget $CHECK_URL -O /dev/null + fi + else + echo "WARNING: Source directory is empty. Skipping $RCLONE_CMD command." + fi fi -else - echo "WARNING: Source directory is empty. Skipping sync command." -fi rm -f /tmp/sync.pid From 08f79288fbd26ffebc0fc0839c81b1f22aecba5f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 29 Apr 2019 22:12:09 -0500 Subject: [PATCH 02/66] Update LICENSE.md --- LICENSE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/LICENSE.md b/LICENSE.md index a2c16f2..2339a1d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,5 @@ Copyright 2019 Pfidr34 + Copyright 2017 Brian J. Cardiff Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 45856a4ebdaffcb50bcf07b64004a8adc801aa69 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 29 Apr 2019 22:32:59 -0500 Subject: [PATCH 03/66] Update README.md --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 50589b0..55ca501 100644 --- a/README.md +++ b/README.md @@ -41,17 +41,22 @@ $ docker run --rm -it -v $(pwd)/config:/config pfidr34/rclone A few environment variables allow you to customize the behavior of the sync: -* `SYNC_SRC` source location for `rclone sync` command -* `SYNC_DEST` destination location for `rclone sync` command -* `CRON` crontab schedule `0 0 * * *` to perform sync every midnight +* `SYNC_SRC` source location for `rclone sync/copy` command +* `SYNC_DEST` destination location for `rclone sync/copy` command +* `SYNC_OPTS` additional options for `rclone sync/copy` command. Defaults to `-v` +* `RCLONE_CMD` set variable to `sync` or `copy` when running rclone. Defaults to `sync` +* `RCLONE_DIR_CMD` set variable to `ls` or `lsf` for source directory check style. Defaults to `ls` +* `RCLONE_DIR_CHECK_SKIP` set variable to skip source directory check before sync. *Use with caution* +* `CRON` crontab schedule `0 0 * * *` to perform sync every midnight. Also supprorts cron shortcuts: `@yearly` `@monthly` `@weekly` `@daily` `@hourly` * `CRON_ABORT` crontab schedule `0 6 * * *` to abort sync at 6am * `FORCE_SYNC` set variable to perform a sync upon boot * `CHECK_URL` [healthchecks.io](https://healthchecks.io) url or similar cron monitoring to perform a `GET` after a successful sync * `SYNC_OPTS` additional options for `rclone sync` command. Defaults to `-v` -* `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Argentina/Buenos_Aires` +* `OUTPUT_LOG` set variable to output log file to /logs +* `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` ```bash -$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Argentina/Buenos_Aires" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr34/rclone +$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Chicago" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr34/rclone ``` See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest syntax and additional options. From 917800cca9d3be9c0952c73c9fc457cc12674690 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 30 Apr 2019 08:12:05 -0500 Subject: [PATCH 04/66] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55ca501..447ec97 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # docker-rclone -**Credit to Brian J. Cardiff for the orginal project @ https://github.com/bcardiff/docker-rclone** - Docker image to perform a [rclone](http://rclone.org) sync based on a cron schedule, with [healthchecks.io](https://healthchecks.io) monitoring. rclone is a command line program to sync files and directories to and from: @@ -60,3 +58,6 @@ $ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYN ``` See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest syntax and additional options. + + +**Credit to Brian J. Cardiff for the orginal project @ https://github.com/bcardiff/docker-rclone** From afdd7dc8fb4af1275bfaffa1f080ba974bcf7a5d Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 30 Apr 2019 21:08:55 -0500 Subject: [PATCH 05/66] Update Dockerfile --- Dockerfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7e26c7c..94acdba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ -FROM alpine:3.9 +ARG BASE=alpine:3.9 +FROM ${BASE} -MAINTAINER pfidr +LABEL maintainer="pfidr" ARG RCLONE_VERSION=current ARG ARCH=amd64 @@ -19,17 +20,15 @@ ENV CHECK_URL= ENV TZ= RUN apk -U add ca-certificates fuse wget dcron tzdata \ - && rm -rf /var/cache/apk/* - -RUN if [ "$RCLONE_VERSION" = "current" ] ; \ - then cd /tmp && wget -q http://downloads.rclone.org/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ - else cd /tmp && wget -q http://downloads.rclone.org/${RCLONE_VERSION}/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ - fi - -RUN cd /tmp \ - && unzip /tmp/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip \ - && mv /tmp/rclone-*-linux-${ARCH}/rclone /usr/bin \ - && rm -r /tmp/rclone* + && rm -rf /var/cache/apk/* + +RUN URL=http://downloads.rclone.org/${RCLONE_VERSION}/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ + URL=${URL/\/current/} ; \ + cd /tmp \ + && wget -q $URL \ + && unzip /tmp/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip \ + && mv /tmp/rclone-*-linux-${ARCH}/rclone /usr/bin \ + && rm -r /tmp/rclone* COPY entrypoint.sh / COPY sync.sh / From d56274e53b090463c28a457a2237beab0421243e Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 1 May 2019 12:48:22 -0500 Subject: [PATCH 06/66] Create FAIL_URL handling proposed by @dantebarba --- Dockerfile | 1 + README.md | 1 + entrypoint.sh | 7 +++++++ sync.sh | 13 +++++++++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94acdba..b69a737 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV CRON= ENV CRON_ABORT= ENV FORCE_SYNC= ENV CHECK_URL= +END FAIL_URL= ENV TZ= RUN apk -U add ca-certificates fuse wget dcron tzdata \ diff --git a/README.md b/README.md index 447ec97..0f03925 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ A few environment variables allow you to customize the behavior of the sync: * `CRON_ABORT` crontab schedule `0 6 * * *` to abort sync at 6am * `FORCE_SYNC` set variable to perform a sync upon boot * `CHECK_URL` [healthchecks.io](https://healthchecks.io) url or similar cron monitoring to perform a `GET` after a successful sync +* `FAIL_URL` Fail URL to perform a `GET` after unsuccessful execution. By default this is `CHECK_URL` with appended "/fail" at the end * `SYNC_OPTS` additional options for `rclone sync` command. Defaults to `-v` * `OUTPUT_LOG` set variable to output log file to /logs * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` diff --git a/entrypoint.sh b/entrypoint.sh index 076f0db..eabd004 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -50,6 +50,13 @@ then else # SYNC_SRC and SYNC_DEST setup # run sync either once or in cron depending on CRON + + #Create fail URL if CHECK_URL is populated but FAIL_URL is not + if [ ! -z "$CHECK_URL" ] && [ -z "$FAIL_URL" ] + then + FAIL_URL="${CHECK_URL}/fail" + fi + if [ -z "$CRONS" ] then echo "INFO: No CRON setting found. Running sync once." diff --git a/sync.sh b/sync.sh index f2e5b11..b047eaa 100755 --- a/sync.sh +++ b/sync.sh @@ -21,9 +21,11 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + export RETURN_CODE=$? else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + export RETURN_CODE=$? fi else if test "$(rclone $RCLONE_DIR_CMD $SYNC_SRC $RCLONE_OPTS)"; then @@ -35,15 +37,22 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + export RETURN_CODE=$? else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + export RETURN_CODE=$? fi if [ -z "$CHECK_URL" ] + then + echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" + else + if [ "$RETURN_CODE" == 0 ] then - echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" - else wget $CHECK_URL -O /dev/null + else + wget $FAIL_URL -O /dev/null + fi fi else echo "WARNING: Source directory is empty. Skipping $RCLONE_CMD command." From 91d629770f25e8a85cd32298659277afb2958461 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 1 May 2019 14:04:35 -0500 Subject: [PATCH 07/66] Add 'move' as a acceptable rclone operation. --- README.md | 10 +++++----- entrypoint.sh | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0f03925..f68e248 100644 --- a/README.md +++ b/README.md @@ -37,12 +37,12 @@ $ docker run --rm -it -v $(pwd)/config:/config pfidr34/rclone ### Perform sync in a daily basis -A few environment variables allow you to customize the behavior of the sync: +A few environment variables allow you to customize the behavior of rclone: -* `SYNC_SRC` source location for `rclone sync/copy` command -* `SYNC_DEST` destination location for `rclone sync/copy` command -* `SYNC_OPTS` additional options for `rclone sync/copy` command. Defaults to `-v` -* `RCLONE_CMD` set variable to `sync` or `copy` when running rclone. Defaults to `sync` +* `SYNC_SRC` source location for `rclone sync/copy/move` command +* `SYNC_DEST` destination location for `rclone sync/copy/move` command +* `SYNC_OPTS` additional options for `rclone sync/copy/move` command. Defaults to `-v` +* `RCLONE_CMD` set variable to `sync` `copy` or `move` when running rclone. Defaults to `sync` * `RCLONE_DIR_CMD` set variable to `ls` or `lsf` for source directory check style. Defaults to `ls` * `RCLONE_DIR_CHECK_SKIP` set variable to skip source directory check before sync. *Use with caution* * `CRON` crontab schedule `0 0 * * *` to perform sync every midnight. Also supprorts cron shortcuts: `@yearly` `@monthly` `@weekly` `@daily` `@hourly` diff --git a/entrypoint.sh b/entrypoint.sh index eabd004..412be2a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,9 +6,9 @@ set -e echo "INFO: Running $(rclone --version | head -n 1)" # Make sure sync/copy command is ok -if [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "SYNC" ] && [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "COPY" ] +if [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "SYNC" ] && [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "COPY" ] && [ "$(echo "$RCLONE_CMD" | tr '[:lower:]' '[:upper:]')" != "MOVE" ] then - echo "WARNING: rclone command '$RCLONE_CMD' is not supported by this container, please use sync or copy. Stopping." + echo "WARNING: rclone command '$RCLONE_CMD' is not supported by this container, please use sync/copy/move. Stopping." exit 1 fi From dc37ad8f2724b28a836992918423e2a94bc2d265 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 1 May 2019 14:11:07 -0500 Subject: [PATCH 08/66] typo --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b69a737..8b9fe66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV CRON= ENV CRON_ABORT= ENV FORCE_SYNC= ENV CHECK_URL= -END FAIL_URL= +ENV FAIL_URL= ENV TZ= RUN apk -U add ca-certificates fuse wget dcron tzdata \ From 25fe6e9a90fd9ddccfed65e1215cb15221d84f58 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 1 May 2019 15:58:05 -0500 Subject: [PATCH 09/66] Add ability to roate logs after x days --- Dockerfile | 1 + README.md | 1 + sync.sh | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8b9fe66..154c326 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ ENV RCLONE_DIR_CMD=ls ENV RCLONE_DIR_CHECK_SKIP= ENV RCLONE_OPTS="--config /config/rclone.conf" ENV OUTPUT_LOG= +ENV ROTATE_LOG= ENV CRON= ENV CRON_ABORT= ENV FORCE_SYNC= diff --git a/README.md b/README.md index f68e248..a20a738 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ A few environment variables allow you to customize the behavior of rclone: * `FAIL_URL` Fail URL to perform a `GET` after unsuccessful execution. By default this is `CHECK_URL` with appended "/fail" at the end * `SYNC_OPTS` additional options for `rclone sync` command. Defaults to `-v` * `OUTPUT_LOG` set variable to output log file to /logs +* `ROTATE_LOG` set variable to delete logs older than specified days from /logs * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` ```bash diff --git a/sync.sh b/sync.sh index b047eaa..587547d 100755 --- a/sync.sh +++ b/sync.sh @@ -4,6 +4,13 @@ set -e echo "INFO: Starting sync.sh pid $$ $(date)" +# Delete logs by user request +if [ ! -z "${ROTATE_LOGS##*[!0-9]*}" ] +then + echo "INFO: Removing logs older than $ROTATE_LOGS day(s)..." + find /logs/*.txt -mtime +$ROTATE_LOGS -type f -delete +fi + if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] then echo "WARNING: A previous $RCLONE_CMD is still running. Skipping new $RCLONE_CMD command." From d3fb318f9c3ef658e8e8208a5ea5f4e53cb83f9f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 1 May 2019 15:59:42 -0500 Subject: [PATCH 10/66] Change variable name --- sync.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sync.sh b/sync.sh index 587547d..7237899 100755 --- a/sync.sh +++ b/sync.sh @@ -5,10 +5,10 @@ set -e echo "INFO: Starting sync.sh pid $$ $(date)" # Delete logs by user request -if [ ! -z "${ROTATE_LOGS##*[!0-9]*}" ] +if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] then - echo "INFO: Removing logs older than $ROTATE_LOGS day(s)..." - find /logs/*.txt -mtime +$ROTATE_LOGS -type f -delete + echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." + find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete fi if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] From 4a8f9de65a85d5d4b54aa9a8ebd2f0b3a959747b Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sat, 22 Jun 2019 21:38:18 -0500 Subject: [PATCH 11/66] Autobuild for Rclone 1.48 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 154c326..c1a336b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE=alpine:3.9 +ARG BASE=alpine:latest FROM ${BASE} LABEL maintainer="pfidr" From 9283a0cc7dc233ac7cc16ebe8fd959346306e21d Mon Sep 17 00:00:00 2001 From: Alex Thomae Date: Wed, 17 Jul 2019 07:41:56 +0200 Subject: [PATCH 12/66] Simplifies `apk add` * removes the option `-U` (`Maximum AGE (in minutes) for index in cache before refresh` set to 1) * removes the deletion of the local cache * adds the option `--no-cache` (`Do not use any local cache path`) --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c1a336b..a6f00b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,7 @@ ENV CHECK_URL= ENV FAIL_URL= ENV TZ= -RUN apk -U add ca-certificates fuse wget dcron tzdata \ - && rm -rf /var/cache/apk/* +RUN apk --no-cache add ca-certificates fuse wget dcron tzdata RUN URL=http://downloads.rclone.org/${RCLONE_VERSION}/rclone-${RCLONE_VERSION}-linux-${ARCH}.zip ; \ URL=${URL/\/current/} ; \ From 13c56634294ab418fbe5b1c21776a40111960a8b Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 19 Aug 2019 16:02:42 -0500 Subject: [PATCH 13/66] Fix log rotation When there are no logs to delete using the LOG_ROTATE variable will cause the container to crash. Thanks @Skaronator --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index 7237899..4357c7a 100755 --- a/sync.sh +++ b/sync.sh @@ -8,7 +8,7 @@ echo "INFO: Starting sync.sh pid $$ $(date)" if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] then echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." - find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete + test -d /logs/*.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete fi if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] From e411ad02d9bdb27ee3c46392cfc6574df0a75559 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 20 Aug 2019 12:31:29 -0500 Subject: [PATCH 14/66] Add change log to readme.md --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a20a738..f8f067c 100644 --- a/README.md +++ b/README.md @@ -61,5 +61,22 @@ $ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYN See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest syntax and additional options. - -**Credit to Brian J. Cardiff for the orginal project @ https://github.com/bcardiff/docker-rclone** +## Changelog + ++ **08/20/2019:** + * Add start command for healthchecks.io calls + * Add debug messages for healthchecks.io calls ++ **08/19/2019:** + * Correct log rotation when there are no logs ++ **07/18/2019:** + * Optimizations to dockerfile ++ **06/22/2019:** + * Update to latest Rclone (v1.48.0) ++ **05/01/2019:** + * Initial release + +
+
+
+
+Credit to Brian J. Cardiff for the orginal project @ https://github.com/bcardiff/docker-rclone From 3f9aecb7509cc5cbe51c6a4d45762aac56f69489 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 20 Aug 2019 12:38:04 -0500 Subject: [PATCH 15/66] Healthchecks.io enhancements Send start command prior to sync Add debug messages to healthcheck.io calls --- sync.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sync.sh b/sync.sh index 4357c7a..d55ba6b 100755 --- a/sync.sh +++ b/sync.sh @@ -26,10 +26,20 @@ else d=$(date +%Y_%m_%d-%H_%M_%S) LOG_FILE="/logs/$d.txt" echo "INFO: Log file output to $LOG_FILE" + if [ ! -z "$CHECK_URL" ] + then + echo "INFO: Sending start signal to healthchecks.io" + wget $CHECK_URL/start -O /dev/null + fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} export RETURN_CODE=$? else + if [ ! -z "$CHECK_URL" ] + then + echo "INFO: Sending start signal to healthchecks.io" + wget $CHECK_URL/start -O /dev/null + fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS export RETURN_CODE=$? @@ -42,11 +52,21 @@ else d=$(date +%Y_%m_%d-%H_%M_%S) LOG_FILE="/logs/$d.txt" echo "INFO: Log file output to $LOG_FILE" + if [ ! -z "$CHECK_URL" ] + then + echo "INFO: Sending start signal to healthchecks.io" + wget $CHECK_URL/start -O /dev/null + fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} export RETURN_CODE=$? else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" + if [ ! -z "$CHECK_URL" ] + then + echo "INFO: Sending start signal to healthchecks.io" + wget $CHECK_URL/start -O /dev/null + fi rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS export RETURN_CODE=$? fi @@ -56,8 +76,10 @@ else else if [ "$RETURN_CODE" == 0 ] then + echo "INFO: Seding complete signal to healthchecks.io" wget $CHECK_URL -O /dev/null else + echo "INFO: Seding failure signal to healthchecks.io" wget $FAIL_URL -O /dev/null fi fi From 52719b4d2b07783efad32d7c8120684afdceaf5d Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 29 Aug 2019 10:00:24 -0500 Subject: [PATCH 16/66] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f8f067c..2654ec0 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **08/29/2019:** + * Update to latest Rclone (v1.49.1) + **08/20/2019:** * Add start command for healthchecks.io calls * Add debug messages for healthchecks.io calls From 0b1738c6d76193f36844be13d3339a49254ac100 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 9 Sep 2019 12:40:47 -0500 Subject: [PATCH 17/66] Update sync.sh Fix for log rotation --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index d55ba6b..fb6e9fa 100755 --- a/sync.sh +++ b/sync.sh @@ -8,7 +8,7 @@ echo "INFO: Starting sync.sh pid $$ $(date)" if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] then echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." - test -d /logs/*.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete + test -d "/logs/*.txt" && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete fi if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] From dc45a6281e1b5f019b4d2fe8e5d1fa66353bec06 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 10 Sep 2019 08:53:30 -0500 Subject: [PATCH 18/66] Change log directory check --- sync.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index fb6e9fa..8497180 100755 --- a/sync.sh +++ b/sync.sh @@ -8,7 +8,7 @@ echo "INFO: Starting sync.sh pid $$ $(date)" if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] then echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." - test -d "/logs/*.txt" && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete + touch /logs/tmp.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete fi if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] From 2af042335e1f2bc8ba0e4bf9d2e690c89ad5ee97 Mon Sep 17 00:00:00 2001 From: tofrie Date: Thu, 12 Sep 2019 23:59:35 +0200 Subject: [PATCH 19/66] Add env variable SYNC_OPTS_EVAL. * SYNC_OPTS_EVAL is a interpolated string like '--backup-dir /old`date -I`'. The commands are first evaluated like in a normal shell, e.g. to '--backup-dir /old2019-09-12' and then appended to SYNC_OPTS. * This is useful to to make iterative backups and keep the old versions of the file in the backup-dir. --- Dockerfile | 1 + sync.sh | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a6f00b4..ebcda58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ ARG ARCH=amd64 ENV SYNC_SRC= ENV SYNC_DEST= ENV SYNC_OPTS=-v +ENV SYNC_OPTS_EVAL= ENV RCLONE_CMD=sync ENV RCLONE_DIR_CMD=ls ENV RCLONE_DIR_CHECK_SKIP= diff --git a/sync.sh b/sync.sh index 8497180..c2c36e0 100755 --- a/sync.sh +++ b/sync.sh @@ -18,6 +18,10 @@ else echo $$ > /tmp/sync.pid + SYNC_OPTS_EVALUALTED=$(eval echo $SYNC_OPTS_EVAL) + echo "INFO: Evaluated SYNC_OPTS_EVAL to:${SYNC_OPTS_EVALUALTED}" + SYNC_OPTS_ALL="${SYNC_OPTS} ${SYNC_OPTS_EVALUALTED}" + if [ ! -z "$RCLONE_DIR_CHECK_SKIP" ] then echo "INFO: Skipping source directory check..." @@ -31,8 +35,8 @@ else echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi - echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? else if [ ! -z "$CHECK_URL" ] @@ -40,8 +44,8 @@ else echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi - echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? fi else @@ -57,17 +61,17 @@ else echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi - echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE}" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS --log-file=${LOG_FILE} + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? else - echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS" + echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" if [ ! -z "$CHECK_URL" ] then echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS + rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? fi if [ -z "$CHECK_URL" ] From 43a204ec206e106f9b9a2a510324999a11868e7f Mon Sep 17 00:00:00 2001 From: tofrie Date: Fri, 13 Sep 2019 00:14:31 +0200 Subject: [PATCH 20/66] Add documentation for SYNC_OPTS_EVAL. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2654ec0..1c42be6 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ A few environment variables allow you to customize the behavior of rclone: * `SYNC_SRC` source location for `rclone sync/copy/move` command * `SYNC_DEST` destination location for `rclone sync/copy/move` command * `SYNC_OPTS` additional options for `rclone sync/copy/move` command. Defaults to `-v` +* `SYNC_OPTS_EVAL` further additional options for `rclone sync/copy/move` command. The variables and commands in the string are first interpolated like in a shell. The interpolated string is appended to SYNC_OPTS. That means '--backup-dir /old\`date -I\`' first evaluates to '--backup-dir /old2019-09-12', which is then appended to SYNC_OPTS. The evaluation happens immediately before rclone is called. * `RCLONE_CMD` set variable to `sync` `copy` or `move` when running rclone. Defaults to `sync` * `RCLONE_DIR_CMD` set variable to `ls` or `lsf` for source directory check style. Defaults to `ls` * `RCLONE_DIR_CHECK_SKIP` set variable to skip source directory check before sync. *Use with caution* @@ -63,6 +64,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **08/29/2019:** + * Add environment variable SYNC_OPTS_EVAL. + **08/29/2019:** * Update to latest Rclone (v1.49.1) + **08/20/2019:** From 950864fd0c2bf35c2c2257aca1e1bb8d2d11e430 Mon Sep 17 00:00:00 2001 From: tofrie Date: Fri, 13 Sep 2019 00:16:32 +0200 Subject: [PATCH 21/66] Fix typos in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c42be6..004c4ce 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog -+ **08/29/2019:** ++ **09/13/2019:** * Add environment variable SYNC_OPTS_EVAL. + **08/29/2019:** * Update to latest Rclone (v1.49.1) From 63509eb1711ea05f1045c54ad64438ea15940c51 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 19 Sep 2019 13:04:42 -0500 Subject: [PATCH 22/66] Update SYNC_EVAL logic Only evaluate and print sync eval if the option was provided. --- sync.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sync.sh b/sync.sh index c2c36e0..d87c795 100755 --- a/sync.sh +++ b/sync.sh @@ -18,9 +18,14 @@ else echo $$ > /tmp/sync.pid - SYNC_OPTS_EVALUALTED=$(eval echo $SYNC_OPTS_EVAL) - echo "INFO: Evaluated SYNC_OPTS_EVAL to:${SYNC_OPTS_EVALUALTED}" - SYNC_OPTS_ALL="${SYNC_OPTS} ${SYNC_OPTS_EVALUALTED}" + if [ ! -z "$SYNC_OPTS_EVAL" ] + then + SYNC_OPTS_EVALUALTED=$(eval echo $SYNC_OPTS_EVAL) + echo "INFO: Evaluated SYNC_OPTS_EVAL to: ${SYNC_OPTS_EVALUALTED}" + SYNC_OPTS_ALL="${SYNC_OPTS} ${SYNC_OPTS_EVALUALTED}" + else + SYNC_OPTS_ALL="${SYNC_OPTS}" + fi if [ ! -z "$RCLONE_DIR_CHECK_SKIP" ] then From c870f542f3603440227dc215e89ee24d75dd6bf6 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 19 Sep 2019 13:27:44 -0500 Subject: [PATCH 23/66] Update README.MD --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 004c4ce..f316bd9 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,14 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog -+ **09/13/2019:** - * Add environment variable SYNC_OPTS_EVAL. ++ **09/19/2019:** + * Add environment variable SYNC_OPTS_EVAL ++ **09/17/2019:** + * Update to latest Rclone (v1.49.3) ++ **09/10/2019:** + * Regression on log rotation ++ **09/09/2019:** + * Update to latest Rclone (v1.49.2) + **08/29/2019:** * Update to latest Rclone (v1.49.1) + **08/20/2019:** From 2969596e857dbdf79ffe01bd13c790384fd1277f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 23 Sep 2019 09:43:10 -0500 Subject: [PATCH 24/66] Add ability to sync once then exit --- Dockerfile | 1 + README.md | 13 +++++-------- entrypoint.sh | 6 ++++++ sync.sh | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index ebcda58..16a4993 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ ENV SYNC_SRC= ENV SYNC_DEST= ENV SYNC_OPTS=-v ENV SYNC_OPTS_EVAL= +ENV SYNC_ONCE= ENV RCLONE_CMD=sync ENV RCLONE_DIR_CMD=ls ENV RCLONE_DIR_CHECK_SKIP= diff --git a/README.md b/README.md index f316bd9..7c2f789 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ A few environment variables allow you to customize the behavior of rclone: * `SYNC_DEST` destination location for `rclone sync/copy/move` command * `SYNC_OPTS` additional options for `rclone sync/copy/move` command. Defaults to `-v` * `SYNC_OPTS_EVAL` further additional options for `rclone sync/copy/move` command. The variables and commands in the string are first interpolated like in a shell. The interpolated string is appended to SYNC_OPTS. That means '--backup-dir /old\`date -I\`' first evaluates to '--backup-dir /old2019-09-12', which is then appended to SYNC_OPTS. The evaluation happens immediately before rclone is called. +* `SYNC_ONCE` set variable to only run the sync one time and then exit the container * `RCLONE_CMD` set variable to `sync` `copy` or `move` when running rclone. Defaults to `sync` * `RCLONE_DIR_CMD` set variable to `ls` or `lsf` for source directory check style. Defaults to `ls` * `RCLONE_DIR_CHECK_SKIP` set variable to skip source directory check before sync. *Use with caution* @@ -64,14 +65,10 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog -+ **09/19/2019:** - * Add environment variable SYNC_OPTS_EVAL -+ **09/17/2019:** - * Update to latest Rclone (v1.49.3) -+ **09/10/2019:** - * Regression on log rotation -+ **09/09/2019:** - * Update to latest Rclone (v1.49.2) ++ **09/23/2019:** + * Add environment variable SYNC_ONCE. ++ **09/13/2019:** + * Add environment variable SYNC_OPTS_EVAL. + **08/29/2019:** * Update to latest Rclone (v1.49.1) + **08/20/2019:** diff --git a/entrypoint.sh b/entrypoint.sh index 412be2a..42d0cec 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -70,6 +70,12 @@ else /sync.sh fi + if [ ! -z "$SYNC_ONCE" ] + then + echo "INFO: SYNC_ONCE option activated. Stopping now." + exit 0 + fi + # Setup cron schedule crontab -d echo "$CRONS /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp diff --git a/sync.sh b/sync.sh index d87c795..ce81c5f 100755 --- a/sync.sh +++ b/sync.sh @@ -8,7 +8,7 @@ echo "INFO: Starting sync.sh pid $$ $(date)" if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] then echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." - touch /logs/tmp.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete + touch /logs/tmp.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete && rm -f /logs/tmp.txt fi if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] From e1e85ad93a99a05137e8ff7c73e670f5782500da Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 23 Sep 2019 09:44:40 -0500 Subject: [PATCH 25/66] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 7c2f789..b668114 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,14 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest * Add environment variable SYNC_ONCE. + **09/13/2019:** * Add environment variable SYNC_OPTS_EVAL. ++ **09/19/2019:** + * Add environment variable SYNC_OPTS_EVAL ++ **09/17/2019:** + * Update to latest Rclone (v1.49.3) ++ **09/10/2019:** + * Regression on log rotation ++ **09/09/2019:** + * Update to latest Rclone (v1.49.2) + **08/29/2019:** * Update to latest Rclone (v1.49.1) + **08/20/2019:** From 6583f02f714f4204327139554751277c2c740049 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 23 Sep 2019 09:45:23 -0500 Subject: [PATCH 26/66] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b668114..b67ed00 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest + **09/23/2019:** * Add environment variable SYNC_ONCE. -+ **09/13/2019:** - * Add environment variable SYNC_OPTS_EVAL. + **09/19/2019:** * Add environment variable SYNC_OPTS_EVAL + **09/17/2019:** From af616c7608017e3b9b7a4068b6d4cfcdca409896 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 23 Sep 2019 10:12:22 -0500 Subject: [PATCH 27/66] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b67ed00..7f730d4 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog + **09/23/2019:** - * Add environment variable SYNC_ONCE. + * Add environment variable SYNC_ONCE + **09/19/2019:** * Add environment variable SYNC_OPTS_EVAL + **09/17/2019:** From ef5c482b534501f2b816397f7458a813fd702e48 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 1 Oct 2019 10:33:02 -0500 Subject: [PATCH 28/66] Increment version --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7f730d4..fac9d2f 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **10/01/2019:** + * Update to latest Rclone (v1.49.4) + **09/23/2019:** * Add environment variable SYNC_ONCE + **09/19/2019:** From 2d144b37225b1fbc99352485b4d9fd374b6f5f7f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sun, 27 Oct 2019 17:37:28 -0500 Subject: [PATCH 29/66] Version update --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index fac9d2f..88d737e 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **10/27/2019:** + * Update to latest Rclone (v1.50.0) ++ **10/07/2019:** + * Update to latest Rclone (v1.49.5) + **10/01/2019:** * Update to latest Rclone (v1.49.4) + **09/23/2019:** From d8d7a559cebafd6327543d123535edd133becf4e Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 6 Nov 2019 08:26:11 -0600 Subject: [PATCH 30/66] Update version --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 88d737e..c577be9 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **11/06/2019:** + * Update to latest Rclone (v1.50.1) + **10/27/2019:** * Update to latest Rclone (v1.50.0) + **10/07/2019:** From 64e0f8ee7a35d31a296dcadb2f6021de59773a16 Mon Sep 17 00:00:00 2001 From: Mike Burgh Date: Thu, 14 Nov 2019 15:31:26 -0600 Subject: [PATCH 31/66] Initial support for passing UID/GID --- Dockerfile | 2 ++ entrypoint.sh | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16a4993..a4e7713 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ ENV FORCE_SYNC= ENV CHECK_URL= ENV FAIL_URL= ENV TZ= +ENV UID= +ENV GID= RUN apk --no-cache add ca-certificates fuse wget dcron tzdata diff --git a/entrypoint.sh b/entrypoint.sh index 42d0cec..1f951eb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,6 +19,41 @@ then exit 1 fi +# Make sure UID and GID are both supplied +if [ -z "$GID" -a ! -z "$UID" ] || [ -z "$UID" -a ! -z "$GID" ] +then + echo "WARNING: Must supply both UID and GID or neither. Stopping." + exit 1 +fi + +# Process UID and GID +if [ ! -z "$GID" ] +then + + #Get group name or add it! + GROUP=$(getent group "$GID" | cut -d: -f1) + USER=rclone + if [ -z "$GROUP" ] + then + GROUP="rclone" + addgroup --gid "$GID" "$GROUP" + fi + + #check if it already exists + if [ ! $(getent passwd "$UID") ] + then + adduser \ + --disabled-password \ + --gecos "" \ + --no-create-home \ + --ingroup "$GROUP" \ + --uid "$UID" \ + "$USER" >/dev/null + fi +else + USER="root" +fi + # Re-write cron shortcut case "$(echo "$CRON" | tr '[:lower:]' '[:upper:]')" in *@YEARLY* ) echo "INFO: Cron shortcut $CRON re-written to 0 0 1 1 *" && CRONS="0 0 1 1 *";; @@ -45,7 +80,7 @@ rm -f /tmp/sync.pid if [ -z "$SYNC_SRC" ] || [ -z "$SYNC_DEST" ] then echo "INFO: No SYNC_SRC and SYNC_DEST found. Starting rclone config" - rclone config $RCLONE_OPTS + su "$USER" -c "rclone config $RCLONE_OPTS" echo "INFO: Define SYNC_SRC and SYNC_DEST to start sync process." else # SYNC_SRC and SYNC_DEST setup @@ -61,13 +96,13 @@ else then echo "INFO: No CRON setting found. Running sync once." echo "INFO: Add CRON=\"0 0 * * *\" to perform sync every midnight" - /sync.sh + su "$USER" -c /sync.sh else if [ -z "$FORCE_SYNC" ] then echo "INFO: Add FORCE_SYNC=1 to perform a sync upon boot" else - /sync.sh + su "$USER" -c /sync.sh fi if [ ! -z "$SYNC_ONCE" ] @@ -78,7 +113,7 @@ else # Setup cron schedule crontab -d - echo "$CRONS /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp + echo "$CRONS su "$USER" -c /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp if [ -z "$CRON_ABORT" ] then echo "INFO: Add CRON_ABORT=\"0 6 * * *\" to cancel outstanding sync at 6am" From ab32406f18f2e3b6d8195f7c8eb58fce4400e9d2 Mon Sep 17 00:00:00 2001 From: Mike Burgh Date: Thu, 14 Nov 2019 15:32:53 -0600 Subject: [PATCH 32/66] typo --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1f951eb..f5bbc3d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -113,7 +113,7 @@ else # Setup cron schedule crontab -d - echo "$CRONS su "$USER" -c /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp + echo "$CRONS su $USER -c /sync.sh >>/tmp/sync.log 2>&1" > /tmp/crontab.tmp if [ -z "$CRON_ABORT" ] then echo "INFO: Add CRON_ABORT=\"0 6 * * *\" to cancel outstanding sync at 6am" From ad02bcf0250dc9e9c3649de182e77f5414dae796 Mon Sep 17 00:00:00 2001 From: Mike Burgh Date: Thu, 14 Nov 2019 19:03:59 -0600 Subject: [PATCH 33/66] Don't assume root, and switch to user if they arleady exist --- entrypoint.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f5bbc3d..ad45340 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,18 +30,19 @@ fi if [ ! -z "$GID" ] then - #Get group name or add it! + #Get group name or add it GROUP=$(getent group "$GID" | cut -d: -f1) - USER=rclone if [ -z "$GROUP" ] then - GROUP="rclone" + GROUP=rclone addgroup --gid "$GID" "$GROUP" fi - #check if it already exists - if [ ! $(getent passwd "$UID") ] + #get user or add it + USER=$(getent passwd "$UID" | cut -d: -f1) + if [ -z "$USER" ] then + USER=rclone adduser \ --disabled-password \ --gecos "" \ @@ -51,7 +52,7 @@ then "$USER" >/dev/null fi else - USER="root" + USER=$(whoami) fi # Re-write cron shortcut From 19c6e1b661a15da6127e061d1580c835686f2ac9 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 18 Nov 2019 10:54:56 -0600 Subject: [PATCH 34/66] Update Readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c577be9..51a525c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,10 @@ A few environment variables allow you to customize the behavior of rclone: * `OUTPUT_LOG` set variable to output log file to /logs * `ROTATE_LOG` set variable to delete logs older than specified days from /logs * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` +* `UID` set variable to specify user to run rclone as. Must also use GID. +* `GID` set variable to specify group to run rclone as. Must also use UID. + +**When using UID/GID the config and/or logs directory must be writeable by this UID** ```bash $ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Chicago" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr34/rclone @@ -65,6 +69,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **11/18/2019:** + * Add support for UID/GID + **11/06/2019:** * Update to latest Rclone (v1.50.1) + **10/27/2019:** From d32a6b2bb96606367fcab7de9adeb875c6fa70d5 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 20 Nov 2019 08:23:22 -0600 Subject: [PATCH 35/66] Update version --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 51a525c..1882e22 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **11/20/2019:** + * Update to latest Rclone (v1.50.2) + **11/18/2019:** * Add support for UID/GID + **11/06/2019:** From a2a6d7dcf1b9d736b76c0cb775d0bab0201b5b3b Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Tue, 28 Jan 2020 08:47:37 -0500 Subject: [PATCH 36/66] Use correct user for Docker Hub image --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1882e22..758e3d1 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ A first run of the container can help in the creation of the file, but feel free ``` $ mkdir config -$ docker run --rm -it -v $(pwd)/config:/config pfidr34/rclone +$ docker run --rm -it -v $(pwd)/config:/config pfidr/rclone ``` ### Perform sync in a daily basis @@ -62,7 +62,7 @@ A few environment variables allow you to customize the behavior of rclone: **When using UID/GID the config and/or logs directory must be writeable by this UID** ```bash -$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Chicago" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr34/rclone +$ docker run --rm -it -v $(pwd)/config:/config -v /path/to/source:/source -e SYNC_SRC="/source" -e SYNC_DEST="dest:path" -e TZ="America/Chicago" -e CRON="0 0 * * *" -e CRON_ABORT="0 6 * * *" -e FORCE_SYNC=1 -e CHECK_URL=https://hchk.io/hchk_uuid pfidr/rclone ``` See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest syntax and additional options. From 262fd1aed545b9181bf505caa3f63b3dda51753e Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sat, 1 Feb 2020 12:04:15 -0600 Subject: [PATCH 37/66] Update rclone version --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 758e3d1..e14a97a 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **02/01/2020:** + * Update to latest Rclone (v1.51.0) + **11/20/2019:** * Update to latest Rclone (v1.50.2) + **11/18/2019:** From 2df34519779045aa7325158764736e46a4e71f7b Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sun, 17 May 2020 18:49:53 -0500 Subject: [PATCH 38/66] Handle spaces in SYNC_SRC and SYNC_DEST options --- README.md | 7 ++++--- sync.sh | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e14a97a..7b946d8 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ $ docker run --rm -it -v $(pwd)/config:/config pfidr/rclone A few environment variables allow you to customize the behavior of rclone: -* `SYNC_SRC` source location for `rclone sync/copy/move` command -* `SYNC_DEST` destination location for `rclone sync/copy/move` command +* `SYNC_SRC` source location for `rclone sync/copy/move` command. Directories with spaces should be wrapped in single quotes. +* `SYNC_DEST` destination location for `rclone sync/copy/move` command. Directories with spaces should be wrapped in single quotes. * `SYNC_OPTS` additional options for `rclone sync/copy/move` command. Defaults to `-v` * `SYNC_OPTS_EVAL` further additional options for `rclone sync/copy/move` command. The variables and commands in the string are first interpolated like in a shell. The interpolated string is appended to SYNC_OPTS. That means '--backup-dir /old\`date -I\`' first evaluates to '--backup-dir /old2019-09-12', which is then appended to SYNC_OPTS. The evaluation happens immediately before rclone is called. * `SYNC_ONCE` set variable to only run the sync one time and then exit the container @@ -52,7 +52,6 @@ A few environment variables allow you to customize the behavior of rclone: * `FORCE_SYNC` set variable to perform a sync upon boot * `CHECK_URL` [healthchecks.io](https://healthchecks.io) url or similar cron monitoring to perform a `GET` after a successful sync * `FAIL_URL` Fail URL to perform a `GET` after unsuccessful execution. By default this is `CHECK_URL` with appended "/fail" at the end -* `SYNC_OPTS` additional options for `rclone sync` command. Defaults to `-v` * `OUTPUT_LOG` set variable to output log file to /logs * `ROTATE_LOG` set variable to delete logs older than specified days from /logs * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` @@ -69,6 +68,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **05/17/2020:** + * Handle spaces in `SYNC_SRC` and `SYNC_DEST` + **02/01/2020:** * Update to latest Rclone (v1.51.0) + **11/20/2019:** diff --git a/sync.sh b/sync.sh index ce81c5f..3b5b0b5 100755 --- a/sync.sh +++ b/sync.sh @@ -41,7 +41,7 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} + rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? else if [ ! -z "$CHECK_URL" ] @@ -50,11 +50,11 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL + rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? fi else - if test "$(rclone $RCLONE_DIR_CMD $SYNC_SRC $RCLONE_OPTS)"; then + if test "$(rclone $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then echo "INFO: Source directory is not empty and can be processed without clear loss of data" if [ ! -z "$OUTPUT_LOG" ] then @@ -67,7 +67,7 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} + rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" @@ -76,7 +76,7 @@ else echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi - rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL + rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? fi if [ -z "$CHECK_URL" ] From 5b4abe8bfda8346506ff03279529bec173907591 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 18 May 2020 17:59:19 -0500 Subject: [PATCH 39/66] Change how sync.sh handles errors from rclone --- sync.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sync.sh b/sync.sh index 3b5b0b5..817ffbb 100755 --- a/sync.sh +++ b/sync.sh @@ -41,8 +41,11 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? + set -e + echo "DEBUG: RETURN CODE $RETURN_CODE" else if [ ! -z "$CHECK_URL" ] then @@ -50,8 +53,11 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" + set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? + set -e + echo "DEBUG: RETURN CODE $RETURN_CODE" fi else if test "$(rclone $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then @@ -67,8 +73,11 @@ else wget $CHECK_URL/start -O /dev/null fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? + set -e + echo "DEBUG: RETURN CODE $RETURN_CODE" else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" if [ ! -z "$CHECK_URL" ] @@ -76,19 +85,23 @@ else echo "INFO: Sending start signal to healthchecks.io" wget $CHECK_URL/start -O /dev/null fi + set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL + set -e export RETURN_CODE=$? + echo "DEBUG: RETURN CODE $RETURN_CODE" fi if [ -z "$CHECK_URL" ] then echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" else - if [ "$RETURN_CODE" == 0 ] + echo "DEBUG: RETURN CODE $RETURN_CODE" + if [ "$RETURN_CODE" == 0 ] then - echo "INFO: Seding complete signal to healthchecks.io" + echo "INFO: Sending complete signal to healthchecks.io" wget $CHECK_URL -O /dev/null else - echo "INFO: Seding failure signal to healthchecks.io" + echo "INFO: Sending failure signal to healthchecks.io" wget $FAIL_URL -O /dev/null fi fi From 0bf2c95662d0907eea6afbfe0b20f51db8f815ea Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 18 May 2020 18:01:49 -0500 Subject: [PATCH 40/66] Remove DEBUG echo --- sync.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sync.sh b/sync.sh index 817ffbb..7b5d2ef 100755 --- a/sync.sh +++ b/sync.sh @@ -45,7 +45,6 @@ else rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? set -e - echo "DEBUG: RETURN CODE $RETURN_CODE" else if [ ! -z "$CHECK_URL" ] then @@ -57,7 +56,6 @@ else rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL export RETURN_CODE=$? set -e - echo "DEBUG: RETURN CODE $RETURN_CODE" fi else if test "$(rclone $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then @@ -77,7 +75,6 @@ else rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? set -e - echo "DEBUG: RETURN CODE $RETURN_CODE" else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" if [ ! -z "$CHECK_URL" ] @@ -89,7 +86,6 @@ else rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL set -e export RETURN_CODE=$? - echo "DEBUG: RETURN CODE $RETURN_CODE" fi if [ -z "$CHECK_URL" ] then From 5d9fbc05d11b165a266e53ade5a698f96ed50f8d Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 27 May 2020 19:36:55 -0500 Subject: [PATCH 41/66] Various updates, see README.md --- Dockerfile | 1 + README.md | 7 ++++++ sync.sh | 73 +++++++++++++++++++++++------------------------------- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4e7713..5c1682c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ENV SYNC_OPTS_EVAL= ENV SYNC_ONCE= ENV RCLONE_CMD=sync ENV RCLONE_DIR_CMD=ls +ENV RCLONE_DIR_CMD_DEPTH=-1 ENV RCLONE_DIR_CHECK_SKIP= ENV RCLONE_OPTS="--config /config/rclone.conf" ENV OUTPUT_LOG= diff --git a/README.md b/README.md index 7b946d8..b7f60e8 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ A few environment variables allow you to customize the behavior of rclone: * `SYNC_ONCE` set variable to only run the sync one time and then exit the container * `RCLONE_CMD` set variable to `sync` `copy` or `move` when running rclone. Defaults to `sync` * `RCLONE_DIR_CMD` set variable to `ls` or `lsf` for source directory check style. Defaults to `ls` +* `RCLONE_DIR_CMD_DEPTH` set the limit of the recursion depth to this. Defaults to `-1` (rclone default) * `RCLONE_DIR_CHECK_SKIP` set variable to skip source directory check before sync. *Use with caution* * `CRON` crontab schedule `0 0 * * *` to perform sync every midnight. Also supprorts cron shortcuts: `@yearly` `@monthly` `@weekly` `@daily` `@hourly` * `CRON_ABORT` crontab schedule `0 6 * * *` to abort sync at 6am @@ -68,6 +69,12 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **05/27/2020:** + * Add `RCLONE_DIR_CMD_DEPTH` option to declare recursion depth when checking if `SYNC_SRC` is empty + * Move call to signal start of healthchecks.io further up in the sync process + * Change when logs are deleted to make sure an active log is not deleted ++ **05/18/2020:** + * Modify how rclone errors are interpreted when passing results to healthchecks.io + **05/17/2020:** * Handle spaces in `SYNC_SRC` and `SYNC_DEST` + **02/01/2020:** diff --git a/sync.sh b/sync.sh index 7b5d2ef..e7b35b9 100755 --- a/sync.sh +++ b/sync.sh @@ -4,20 +4,28 @@ set -e echo "INFO: Starting sync.sh pid $$ $(date)" -# Delete logs by user request -if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] -then - echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." - touch /logs/tmp.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete && rm -f /logs/tmp.txt -fi - if [ `lsof | grep $0 | wc -l | tr -d ' '` -gt 1 ] then echo "WARNING: A previous $RCLONE_CMD is still running. Skipping new $RCLONE_CMD command." else + # Signal start oh sync.sh to healthchecks.io + if [ ! -z "$CHECK_URL" ] + then + echo "INFO: Sending start signal to healthchecks.io" + wget $CHECK_URL/start -O /dev/null + fi + + # Delete logs by user request + if [ ! -z "${ROTATE_LOG##*[!0-9]*}" ] + then + echo "INFO: Removing logs older than $ROTATE_LOG day(s)..." + touch /logs/tmp.txt && find /logs/*.txt -mtime +$ROTATE_LOG -type f -delete && rm -f /logs/tmp.txt + fi + echo $$ > /tmp/sync.pid + # Evaluate any sync options if [ ! -z "$SYNC_OPTS_EVAL" ] then SYNC_OPTS_EVALUALTED=$(eval echo $SYNC_OPTS_EVAL) @@ -35,22 +43,12 @@ else d=$(date +%Y_%m_%d-%H_%M_%S) LOG_FILE="/logs/$d.txt" echo "INFO: Log file output to $LOG_FILE" - if [ ! -z "$CHECK_URL" ] - then - echo "INFO: Sending start signal to healthchecks.io" - wget $CHECK_URL/start -O /dev/null - fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} export RETURN_CODE=$? set -e else - if [ ! -z "$CHECK_URL" ] - then - echo "INFO: Sending start signal to healthchecks.io" - wget $CHECK_URL/start -O /dev/null - fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL @@ -58,18 +56,13 @@ else set -e fi else - if test "$(rclone $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then + if test "$(rclone --max-depth $RCLONE_DIR_CMD_DEPTH $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then echo "INFO: Source directory is not empty and can be processed without clear loss of data" if [ ! -z "$OUTPUT_LOG" ] then d=$(date +%Y_%m_%d-%H_%M_%S) LOG_FILE="/logs/$d.txt" echo "INFO: Log file output to $LOG_FILE" - if [ ! -z "$CHECK_URL" ] - then - echo "INFO: Sending start signal to healthchecks.io" - wget $CHECK_URL/start -O /dev/null - fi echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} @@ -77,35 +70,31 @@ else set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" - if [ ! -z "$CHECK_URL" ] - then - echo "INFO: Sending start signal to healthchecks.io" - wget $CHECK_URL/start -O /dev/null - fi set +e rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL set -e export RETURN_CODE=$? fi - if [ -z "$CHECK_URL" ] - then - echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" - else - echo "DEBUG: RETURN CODE $RETURN_CODE" - if [ "$RETURN_CODE" == 0 ] - then - echo "INFO: Sending complete signal to healthchecks.io" - wget $CHECK_URL -O /dev/null - else - echo "INFO: Sending failure signal to healthchecks.io" - wget $FAIL_URL -O /dev/null - fi - fi else echo "WARNING: Source directory is empty. Skipping $RCLONE_CMD command." fi fi + # Wrap up healthchecks.io call with complete or failure signal + if [ -z "$CHECK_URL" ] + then + echo "INFO: Define CHECK_URL with https://healthchecks.io to monitor $RCLONE_CMD job" + else + if [ "$RETURN_CODE" == 0 ] + then + echo "INFO: Sending complete signal to healthchecks.io" + wget $CHECK_URL -O /dev/null + else + echo "INFO: Sending failure signal to healthchecks.io" + wget $FAIL_URL -O /dev/null + fi + fi + rm -f /tmp/sync.pid fi From 7af4ba16434a0a0e545a6c86cf1097fc1a9aae45 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 27 May 2020 19:58:26 -0500 Subject: [PATCH 42/66] Updated to Rclone 1.52.0 and added build script --- README.md | 1 + build.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 build.sh diff --git a/README.md b/README.md index b7f60e8..e7fb5bb 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog + **05/27/2020:** + * Update to latest Rclone (v1.52.0) * Add `RCLONE_DIR_CMD_DEPTH` option to declare recursion depth when checking if `SYNC_SRC` is empty * Move call to signal start of healthchecks.io further up in the sync process * Change when logs are deleted to make sure an active log is not deleted diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..b7093bf --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +docker build --no-cache --build-arg RCLONE_VERSION=v1.47.0 -t pfidr/rclone:1.47 -t pfidr/rclone:1.47.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.48.0 -t pfidr/rclone:1.48 -t pfidr/rclone:1.48.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.0 -t pfidr/rclone:1.49.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.1 -t pfidr/rclone:1.49.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.2 -t pfidr/rclone:1.49.2 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.3 -t pfidr/rclone:1.49.3 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.4 -t pfidr/rclone:1.49.4 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.49.5 -t pfidr/rclone:1.49.5 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.50.0 -t pfidr/rclone:1.50.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.50.1 -t pfidr/rclone:1.50.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.50.2 -t pfidr/rclone:1.50.2 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.51.0 -t pfidr/rclone:1.51.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 -t pfidr/rclone:latest . + From 8476c6cfc929a386363cab130a71e91e9fe28b94 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 8 Jun 2020 21:08:34 -0500 Subject: [PATCH 43/66] eval rclone command | set error handling on source dir check --- README.md | 3 +++ entrypoint.sh | 10 +++++----- sync.sh | 10 ++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e7fb5bb..1cf406b 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,9 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **06/28/2020:** + * Eval the entire rclone command + * Modify how rclone errors are interpreted when checking if source directory is empty + **05/27/2020:** * Update to latest Rclone (v1.52.0) * Add `RCLONE_DIR_CMD_DEPTH` option to declare recursion depth when checking if `SYNC_SRC` is empty diff --git a/entrypoint.sh b/entrypoint.sh index ad45340..c0f5274 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,18 +21,18 @@ fi # Make sure UID and GID are both supplied if [ -z "$GID" -a ! -z "$UID" ] || [ -z "$UID" -a ! -z "$GID" ] -then +then echo "WARNING: Must supply both UID and GID or neither. Stopping." exit 1 fi # Process UID and GID -if [ ! -z "$GID" ] +if [ ! -z "$GID" ] then #Get group name or add it GROUP=$(getent group "$GID" | cut -d: -f1) - if [ -z "$GROUP" ] + if [ -z "$GROUP" ] then GROUP=rclone addgroup --gid "$GID" "$GROUP" @@ -41,7 +41,7 @@ then #get user or add it USER=$(getent passwd "$UID" | cut -d: -f1) if [ -z "$USER" ] - then + then USER=rclone adduser \ --disabled-password \ @@ -87,7 +87,7 @@ else # SYNC_SRC and SYNC_DEST setup # run sync either once or in cron depending on CRON - #Create fail URL if CHECK_URL is populated but FAIL_URL is not + #Create fail URL if CHECK_URL is populated but FAIL_URL is not if [ ! -z "$CHECK_URL" ] && [ -z "$FAIL_URL" ] then FAIL_URL="${CHECK_URL}/fail" diff --git a/sync.sh b/sync.sh index e7b35b9..7812e38 100755 --- a/sync.sh +++ b/sync.sh @@ -45,18 +45,20 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" export RETURN_CODE=$? set -e fi else + set e+ if test "$(rclone --max-depth $RCLONE_DIR_CMD_DEPTH $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then + set e- echo "INFO: Source directory is not empty and can be processed without clear loss of data" if [ ! -z "$OUTPUT_LOG" ] then @@ -65,13 +67,13 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE} + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set -e export RETURN_CODE=$? fi From e9a6f892529ead65837c034b5674d8f906cd16e6 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 9 Jun 2020 09:37:42 -0500 Subject: [PATCH 44/66] Fix whitespace issues in SYNC_SRC and SYNC_DEST --- sync.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sync.sh b/sync.sh index 7812e38..2b40358 100755 --- a/sync.sh +++ b/sync.sh @@ -45,13 +45,13 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" + eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL" export RETURN_CODE=$? set -e fi @@ -67,13 +67,13 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" + eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL" set -e export RETURN_CODE=$? fi From de665fb9684f965dfb41986bc2c4d971ae5eee2f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 9 Jun 2020 18:10:11 -0500 Subject: [PATCH 45/66] Revert last change --- sync.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sync.sh b/sync.sh index 2b40358..7812e38 100755 --- a/sync.sh +++ b/sync.sh @@ -45,13 +45,13 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL" + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" export RETURN_CODE=$? set -e fi @@ -67,13 +67,13 @@ else echo "INFO: Log file output to $LOG_FILE" echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" set +e - eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e - eval "rclone $RCLONE_CMD "$(eval echo $SYNC_SRC)" "$(eval echo $SYNC_DEST)" $RCLONE_OPTS $SYNC_OPTS_ALL" + eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set -e export RETURN_CODE=$? fi From 3a214d2bf4c927ca7e1f8e875f236724ad277e76 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 11 Jun 2020 11:24:39 -0500 Subject: [PATCH 46/66] Update to Rclone 1.52.1 --- README.md | 4 +++- build.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1cf406b..753c763 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,9 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog -+ **06/28/2020:** ++ **06/11/2020:** + * Update to latest Rclone (v1.52.1) ++ **05/28/2020:** * Eval the entire rclone command * Modify how rclone errors are interpreted when checking if source directory is empty + **05/27/2020:** diff --git a/build.sh b/build.sh index b7093bf..cf14a3f 100644 --- a/build.sh +++ b/build.sh @@ -12,5 +12,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.50.0 -t pfidr/rclone:1.50. docker build --no-cache --build-arg RCLONE_VERSION=v1.50.1 -t pfidr/rclone:1.50.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.50.2 -t pfidr/rclone:1.50.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.51.0 -t pfidr/rclone:1.51.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 -t pfidr/rclone:latest . - +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 -t pfidr/rclone:latest . From 0a66a61a5c6fffc886d67b180328a769e39a9842 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 25 Jun 2020 09:02:20 -0500 Subject: [PATCH 47/66] Update to 1.52.2 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 753c763..b020b22 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **06/25/2020:** + * Update to latest Rclone (v1.52.2) + **06/11/2020:** * Update to latest Rclone (v1.52.1) + **05/28/2020:** diff --git a/build.sh b/build.sh index cf14a3f..6d9e2f6 100644 --- a/build.sh +++ b/build.sh @@ -13,4 +13,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.50.1 -t pfidr/rclone:1.50. docker build --no-cache --build-arg RCLONE_VERSION=v1.50.2 -t pfidr/rclone:1.50.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.51.0 -t pfidr/rclone:1.51.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 -t pfidr/rclone:latest . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 -t pfidr/rclone:latest -t rclone_test . From 0fd259a73111c5d630bfc3213588346d80de1cce Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 20 Aug 2020 19:32:38 -0500 Subject: [PATCH 48/66] Update to 1.52.3 --- README.md | 2 ++ build.sh | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b020b22..4cc5380 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **08/20/2020:** + * Update to latest Rclone (v1.52.3) + **06/25/2020:** * Update to latest Rclone (v1.52.2) + **06/11/2020:** diff --git a/build.sh b/build.sh index 6d9e2f6..b6c1dcf 100644 --- a/build.sh +++ b/build.sh @@ -14,4 +14,6 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.50.2 -t pfidr/rclone:1.50. docker build --no-cache --build-arg RCLONE_VERSION=v1.51.0 -t pfidr/rclone:1.51.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 -t pfidr/rclone:latest -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 -t pfidr/rclone:latest -t rclone_test . + From afb75ca5b00474979b3ca98edb4f6648ba13f634 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 31 Aug 2020 17:51:29 -0500 Subject: [PATCH 49/66] Add ability to send log data to healthchecks.io --- Dockerfile | 1 + README.md | 3 +++ sync.sh | 22 ++++++++++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c1682c..f3f6c69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ ENV CRON_ABORT= ENV FORCE_SYNC= ENV CHECK_URL= ENV FAIL_URL= +ENV HC_LOG= ENV TZ= ENV UID= ENV GID= diff --git a/README.md b/README.md index 4cc5380..4e59726 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ A few environment variables allow you to customize the behavior of rclone: * `FORCE_SYNC` set variable to perform a sync upon boot * `CHECK_URL` [healthchecks.io](https://healthchecks.io) url or similar cron monitoring to perform a `GET` after a successful sync * `FAIL_URL` Fail URL to perform a `GET` after unsuccessful execution. By default this is `CHECK_URL` with appended "/fail" at the end +* `HC_LOG` set variable to send log data to healthchecks.io. `OUTPUT_LOG` must also be set. * `OUTPUT_LOG` set variable to output log file to /logs * `ROTATE_LOG` set variable to delete logs older than specified days from /logs * `TZ` set the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to use for the cron and log `America/Chicago` @@ -69,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **08/31/2020:** + * Add ability to send log data to healthchecks.io - See `HC_LOG` environment variable + **08/20/2020:** * Update to latest Rclone (v1.52.3) + **06/25/2020:** diff --git a/sync.sh b/sync.sh index 7812e38..e930421 100755 --- a/sync.sh +++ b/sync.sh @@ -89,11 +89,25 @@ else else if [ "$RETURN_CODE" == 0 ] then - echo "INFO: Sending complete signal to healthchecks.io" - wget $CHECK_URL -O /dev/null + if [ ! -z "$OUTPUT_LOG" ] && [ ! -z "$HC_LOG" ] && [ -f "$LOG_FILE" ] + then + echo "INFO: Sending complete signal with logs to healthchecks.io" + m=$(tail -c 10000 "$LOG_FILE") + wget $CHECK_URL -O /dev/null --post-data="$m" + else + echo "INFO: Sending complete signal to healthchecks.io" + wget $CHECK_URL -O /dev/null --post-data="SUCCESS" + fi else - echo "INFO: Sending failure signal to healthchecks.io" - wget $FAIL_URL -O /dev/null + if [ ! -z "$OUTPUT_LOG" ] && [ ! -z "$HC_LOG" ] && [ -f "$LOG_FILE" ] + then + echo "INFO: Sending failure signal with logs to healthchecks.io" + m=$(tail -c 10000 "$LOG_FILE") + wget $FAIL_URL -O /dev/null --post-data="$m" + else + echo "INFO: Sending failure signal to healthchecks.io" + wget $FAIL_URL -O /dev/null --post-data="Check container logs" + fi fi fi From 8ad2acca87b4248ae030686978ccd3fced79ec8a Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sat, 5 Sep 2020 10:51:15 -0500 Subject: [PATCH 50/66] Update to 1.53.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e59726..3557b14 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **09/05/2020:** + * Update to latest Rclone (v1.53.0) + **08/31/2020:** * Add ability to send log data to healthchecks.io - See `HC_LOG` environment variable + **08/20/2020:** diff --git a/build.sh b/build.sh index b6c1dcf..10c6351 100644 --- a/build.sh +++ b/build.sh @@ -15,5 +15,6 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.51.0 -t pfidr/rclone:1.51. docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 -t pfidr/rclone:latest -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 949a7dca35bc4d1601ce48d859a89f3842651be9 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Sun, 13 Sep 2020 09:34:58 -0500 Subject: [PATCH 51/66] Update to 1.53.1 --- README.md | 2 ++ build.sh | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3557b14..76966fd 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **09/13/2020:** + * Update to latest Rclone (v1.53.1) + **09/05/2020:** * Update to latest Rclone (v1.53.0) + **08/31/2020:** diff --git a/build.sh b/build.sh index 10c6351..d7b3f90 100644 --- a/build.sh +++ b/build.sh @@ -16,5 +16,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.52.0 -t pfidr/rclone:1.52. docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . - +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From bb1f665e46e51b90460823fb234b13132a2313ff Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 28 Oct 2020 16:18:29 -0500 Subject: [PATCH 52/66] Update to 1.53.2 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76966fd..f7ae6c6 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **10/28/2020:** + * Update to latest Rclone (v1.53.2) + **09/13/2020:** * Update to latest Rclone (v1.53.1) + **09/05/2020:** diff --git a/build.sh b/build.sh index d7b3f90..14fb04f 100644 --- a/build.sh +++ b/build.sh @@ -17,4 +17,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.52.1 -t pfidr/rclone:1.52. docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From f5ca4af26227cf82054b3f9d5031b9830bc9f451 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 23 Nov 2020 10:59:24 -0600 Subject: [PATCH 53/66] Update to 1.53.3 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f7ae6c6..5516b48 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **11/23/2020:** + * Update to latest Rclone (v1.53.3) + **10/28/2020:** * Update to latest Rclone (v1.53.2) + **09/13/2020:** diff --git a/build.sh b/build.sh index 14fb04f..4957ea0 100644 --- a/build.sh +++ b/build.sh @@ -18,4 +18,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.52.2 -t pfidr/rclone:1.52. docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52.3 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 760b8bc93a517fcbc523b7bf678648231cba8b68 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Fri, 22 Jan 2021 12:45:26 -0600 Subject: [PATCH 54/66] Update to 1.53.4 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5516b48..489ab35 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **01/22/2021:** + * Update to latest Rclone (v1.53.4) + **11/23/2020:** * Update to latest Rclone (v1.53.3) + **10/28/2020:** diff --git a/build.sh b/build.sh index 4957ea0..60d71e5 100644 --- a/build.sh +++ b/build.sh @@ -19,4 +19,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.52.3 -t pfidr/rclone:1.52. docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53.4 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 5d2a808b2c09b50ce91e78798c4bb69941a98476 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 4 Feb 2021 20:30:13 -0600 Subject: [PATCH 55/66] Update to 1.54.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 489ab35..9272665 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **02/04/2021:** + * Update to latest Rclone (v1.54.0) + **01/22/2021:** * Update to latest Rclone (v1.53.4) + **11/23/2020:** diff --git a/build.sh b/build.sh index 60d71e5..738e12f 100644 --- a/build.sh +++ b/build.sh @@ -20,4 +20,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.53.0 -t pfidr/rclone:1.53. docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53.4 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53.4 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 30d4e8b1186110df7d742656f1637be02392f951 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 10 Mar 2021 09:04:32 -0600 Subject: [PATCH 56/66] Update to 1.54.1 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9272665..e674159 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **03/10/2021:** + * Update to latest Rclone (v1.54.1) + **02/04/2021:** * Update to latest Rclone (v1.54.0) + **01/22/2021:** diff --git a/build.sh b/build.sh index 738e12f..92e4a74 100644 --- a/build.sh +++ b/build.sh @@ -21,4 +21,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.53.1 -t pfidr/rclone:1.53. docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53.4 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From e284c5bd5a01f31bae3ffe3c63634063c0827240 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Fri, 25 Jun 2021 19:48:26 -0500 Subject: [PATCH 57/66] Update to 1.55.0 & 1.55.1 --- README.md | 4 ++++ build.sh | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e674159..20cb112 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **06/25/2021:** + * Update to latest Rclone (v1.55.1) ++ **06/25/2021:** + * Update to latest Rclone (v1.55.0) + **03/10/2021:** * Update to latest Rclone (v1.54.1) + **02/04/2021:** diff --git a/build.sh b/build.sh index 92e4a74..e6ead47 100644 --- a/build.sh +++ b/build.sh @@ -22,4 +22,6 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.53.2 -t pfidr/rclone:1.53. docker build --no-cache --build-arg RCLONE_VERSION=v1.53.3 -t pfidr/rclone:1.53.3 . docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53.4 . docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.55.0 -t pfidr/rclone:1.55.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 531570b41ea5a44175f1459a7fe4e55c6f3228bd Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Wed, 25 Aug 2021 13:48:28 -0500 Subject: [PATCH 58/66] Update to 1.56.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 20cb112..f5614eb 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **08/25/2021:** + * Update to latest Rclone (v1.56.0) + **06/25/2021:** * Update to latest Rclone (v1.55.1) + **06/25/2021:** diff --git a/build.sh b/build.sh index e6ead47..d54e9e3 100644 --- a/build.sh +++ b/build.sh @@ -24,4 +24,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.53.4 -t pfidr/rclone:1.53. docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.55.0 -t pfidr/rclone:1.55.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 39e4cb4e877b6b31e293a55cb682e6fc0e9fc57d Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 27 Sep 2021 14:08:10 -0500 Subject: [PATCH 59/66] Update to 1.56.1 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5614eb..be2bf70 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **09/27/2021:** + * Update to latest Rclone (v1.56.1) + **08/25/2021:** * Update to latest Rclone (v1.56.0) + **06/25/2021:** diff --git a/build.sh b/build.sh index d54e9e3..69386fd 100644 --- a/build.sh +++ b/build.sh @@ -25,4 +25,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.54.0 -t pfidr/rclone:1.54. docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.55.0 -t pfidr/rclone:1.55.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 2c0e71233906c01c70e8b01e8bb25f03212fc87d Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 4 Oct 2021 09:22:35 -0500 Subject: [PATCH 60/66] Update to 1.56.2 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index be2bf70..ec8cc77 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **10/04/2021:** + * Update to latest Rclone (v1.56.2) + **09/27/2021:** * Update to latest Rclone (v1.56.1) + **08/25/2021:** diff --git a/build.sh b/build.sh index 69386fd..0b78e64 100644 --- a/build.sh +++ b/build.sh @@ -26,4 +26,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.54.1 -t pfidr/rclone:1.54. docker build --no-cache --build-arg RCLONE_VERSION=v1.55.0 -t pfidr/rclone:1.55.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From b322fccc3504443030b0f83b8c5503bd11da5a74 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 18 Nov 2021 15:06:09 -0600 Subject: [PATCH 61/66] Update to 1.57.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec8cc77..7499ffd 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **11/18/2021:** + * Update to latest Rclone (v1.57.0) + **10/04/2021:** * Update to latest Rclone (v1.56.2) + **09/27/2021:** diff --git a/build.sh b/build.sh index 0b78e64..c55e9b3 100644 --- a/build.sh +++ b/build.sh @@ -27,4 +27,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.55.0 -t pfidr/rclone:1.55. docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.57.0 -t pfidr/rclone:1.57.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 46c82157217ae66f90479bad38f8037d5fe3c904 Mon Sep 17 00:00:00 2001 From: mistermult <38668684+mistermult@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:28:27 +0100 Subject: [PATCH 62/66] Fix wrong healtcheck for DIR_CHECK, no OUTPUT_LOG. - This fixes the problem that the reported healtcheck is ok despite rclone exiting with an error, i.e. with return code unequal from 0. - Moreover, it prints the return code for easy inspection of logs. --- sync.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sync.sh b/sync.sh index e930421..b27e248 100755 --- a/sync.sh +++ b/sync.sh @@ -55,6 +55,7 @@ else export RETURN_CODE=$? set -e fi + echo "INFO: $RCLONE_CMD finished with return code: $RETURN_CODE" else set e+ if test "$(rclone --max-depth $RCLONE_DIR_CMD_DEPTH $RCLONE_DIR_CMD "$(eval echo $SYNC_SRC)" $RCLONE_OPTS)"; then @@ -70,12 +71,14 @@ else eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL --log-file=${LOG_FILE}" export RETURN_CODE=$? set -e + echo "INFO: $RCLONE_CMD finished with return code: $RETURN_CODE" else echo "INFO: Starting rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" set +e eval "rclone $RCLONE_CMD $SYNC_SRC $SYNC_DEST $RCLONE_OPTS $SYNC_OPTS_ALL" - set -e export RETURN_CODE=$? + set -e + echo "INFO: $RCLONE_CMD finished with return code: $RETURN_CODE" fi else echo "WARNING: Source directory is empty. Skipping $RCLONE_CMD command." From 86bfdd73cdaa1b775674893ba98e88cd938962e1 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 25 Apr 2022 09:30:06 -0500 Subject: [PATCH 63/66] Update to 1.58.0 --- README.md | 4 ++++ build.sh | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7499ffd..adda257 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **04/25/2022:** + * Display exit code in console output + * Fix issue with healthcheck + * Update to latest Rclone (v1.58.0) + **11/18/2021:** * Update to latest Rclone (v1.57.0) + **10/04/2021:** diff --git a/build.sh b/build.sh index c55e9b3..c88a43e 100644 --- a/build.sh +++ b/build.sh @@ -28,4 +28,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.55.1 -t pfidr/rclone:1.55. docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.57.0 -t pfidr/rclone:1.57.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.57.0 -t pfidr/rclone:1.57.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.58.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 3d39e35305ecb2fde1b842d2d1a0e80a3bd5fa6f Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Mon, 18 Jul 2022 13:05:50 -0500 Subject: [PATCH 64/66] Update to 1.59.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index adda257..73cbd73 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **07/18/2022:** + * Update to latest Rclone (v1.59.0) + **04/25/2022:** * Display exit code in console output * Fix issue with healthcheck diff --git a/build.sh b/build.sh index c88a43e..553efd9 100644 --- a/build.sh +++ b/build.sh @@ -29,4 +29,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.56.0 -t pfidr/rclone:1.56. docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56.1 . docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.57.0 -t pfidr/rclone:1.57.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.58.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.58.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.59.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From 2fb9c195554bf2bb1a9b14d5fac833e4ee9cce29 Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Tue, 7 Feb 2023 10:33:40 -0600 Subject: [PATCH 65/66] Update to 1.61.1 --- build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 553efd9..71a0497 100644 --- a/build.sh +++ b/build.sh @@ -30,4 +30,7 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.56.1 -t pfidr/rclone:1.56. docker build --no-cache --build-arg RCLONE_VERSION=v1.56.2 -t pfidr/rclone:1.56.2 . docker build --no-cache --build-arg RCLONE_VERSION=v1.57.0 -t pfidr/rclone:1.57.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.58.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.59.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.59.0 -t pfidr/rclone:1.59.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.60.0 -t pfidr/rclone:1.60.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.61.0 -t pfidr/rclone:1.61.0 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.61.1 -t pfidr/rclone:1.61.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . From c59baf39ec8bf8d357d446a05d92f85456f19f0a Mon Sep 17 00:00:00 2001 From: pfidr34 Date: Thu, 6 Jul 2023 09:51:19 -0500 Subject: [PATCH 66/66] Update to version 1.63.0 --- README.md | 2 ++ build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73cbd73..3e57ce2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ See [rclone sync docs](https://rclone.org/commands/rclone_sync/) for source/dest ## Changelog ++ **07/06/2023:** + * Update to latest Rclone (v1.63.0) + **07/18/2022:** * Update to latest Rclone (v1.59.0) + **04/25/2022:** diff --git a/build.sh b/build.sh index 71a0497..a6ff8e7 100644 --- a/build.sh +++ b/build.sh @@ -33,4 +33,5 @@ docker build --no-cache --build-arg RCLONE_VERSION=v1.58.0 -t pfidr/rclone:1.58. docker build --no-cache --build-arg RCLONE_VERSION=v1.59.0 -t pfidr/rclone:1.59.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.60.0 -t pfidr/rclone:1.60.0 . docker build --no-cache --build-arg RCLONE_VERSION=v1.61.0 -t pfidr/rclone:1.61.0 . -docker build --no-cache --build-arg RCLONE_VERSION=v1.61.1 -t pfidr/rclone:1.61.1 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test . +docker build --no-cache --build-arg RCLONE_VERSION=v1.61.1 -t pfidr/rclone:1.61.1 . +docker build --no-cache --build-arg RCLONE_VERSION=v1.63.0 -t pfidr/rclone:1.63.0 -t pfidr/rclone:latest -t pfidr/rclone:test -t rclone_test .