diff --git a/roles/web-logs/files/sync-http-logs.sh b/roles/web-logs/files/sync-http-logs.sh index 45d1e0f..0846385 100755 --- a/roles/web-logs/files/sync-http-logs.sh +++ b/roles/web-logs/files/sync-http-logs.sh @@ -6,6 +6,7 @@ umask 022 TARGET="/var/cache/sync-http-logs" CONFIG="/etc/rclone/rclone.conf" LOGDIR="/var/log/rclone" +RCLONE="/usr/local/bin/rclone" timestamp="$(date +%Y%m%d%H%M%S)" @@ -14,14 +15,14 @@ if [ ! -d "$TARGET" ]; then exit 1 fi -for host in $(rclone --config "$CONFIG" listremotes | tr -d ":") ; do - fqdn="$(rclone --config "$CONFIG" config show "$host" | \ +for host in $("$RCLONE" --config "$CONFIG" listremotes | tr -d ":") ; do + fqdn="$("$RCLONE" --config "$CONFIG" config show "$host" | \ awk '{ if ($1 == "host") print $3 }')" if [ ! -d "${TARGET}/${fqdn}" ]; then mkdir "${TARGET}/${fqdn}" fi log="${LOGDIR}/${fqdn}.${timestamp}.log" - if ! rclone --config "$CONFIG" --log-file "$log" --log-level INFO \ + if ! "$RCLONE" --config "$CONFIG" --log-file "$log" --log-level INFO \ sync "${host}:/" "${TARGET}/${fqdn}/"; then cat "$log" fi