web-logs: Use absolute path for rclone binary
This commit is contained in:
parent
74a75772c2
commit
663038ced2
1 changed files with 4 additions and 3 deletions
|
@ -6,6 +6,7 @@ umask 022
|
||||||
TARGET="/var/cache/sync-http-logs"
|
TARGET="/var/cache/sync-http-logs"
|
||||||
CONFIG="/etc/rclone/rclone.conf"
|
CONFIG="/etc/rclone/rclone.conf"
|
||||||
LOGDIR="/var/log/rclone"
|
LOGDIR="/var/log/rclone"
|
||||||
|
RCLONE="/usr/local/bin/rclone"
|
||||||
|
|
||||||
timestamp="$(date +%Y%m%d%H%M%S)"
|
timestamp="$(date +%Y%m%d%H%M%S)"
|
||||||
|
|
||||||
|
@ -14,14 +15,14 @@ if [ ! -d "$TARGET" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for host in $(rclone --config "$CONFIG" listremotes | tr -d ":") ; do
|
for host in $("$RCLONE" --config "$CONFIG" listremotes | tr -d ":") ; do
|
||||||
fqdn="$(rclone --config "$CONFIG" config show "$host" | \
|
fqdn="$("$RCLONE" --config "$CONFIG" config show "$host" | \
|
||||||
awk '{ if ($1 == "host") print $3 }')"
|
awk '{ if ($1 == "host") print $3 }')"
|
||||||
if [ ! -d "${TARGET}/${fqdn}" ]; then
|
if [ ! -d "${TARGET}/${fqdn}" ]; then
|
||||||
mkdir "${TARGET}/${fqdn}"
|
mkdir "${TARGET}/${fqdn}"
|
||||||
fi
|
fi
|
||||||
log="${LOGDIR}/${fqdn}.${timestamp}.log"
|
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
|
sync "${host}:/" "${TARGET}/${fqdn}/"; then
|
||||||
cat "$log"
|
cat "$log"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue