From de161aa00ca9ab0e893df022076661b8bd3e3993 Mon Sep 17 00:00:00 2001 From: roleo Date: Fri, 19 Jan 2024 13:52:24 +0100 Subject: [PATCH] Fix https://github.com/roleoroleo/yi-hack-MStar/issues/531#issuecomment-1894363236 --- src/static/static/home/yi-hack/script/ftppush.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/static/static/home/yi-hack/script/ftppush.sh b/src/static/static/home/yi-hack/script/ftppush.sh index 2197d56..6907058 100755 --- a/src/static/static/home/yi-hack/script/ftppush.sh +++ b/src/static/static/home/yi-hack/script/ftppush.sh @@ -151,7 +151,7 @@ translateFULLFNWithTz () TR_HOUR_PREFIX="" TR_SUFFIX="" TR_DATE="${1:15:4}-${1:20:2}-${1:23:2} ${1:26:2}:${1:30:2}:${1:33:2}" - TR_SUFFIX=${1:35:7} + TR_SUFFIX=${1:36:6} TR_SECONDS_1970=$(date +%s -u -d "$TR_DATE") TR_RET=$(TZ=$TIMEZONE date +$TR_PREFIX%YY%mM%dD%HH/$TR_HOUR_PREFIX%MM%SS$TR_SUFFIX -d "@$TR_SECONDS_1970") echo $TR_RET @@ -179,9 +179,7 @@ uploadToFtp () # # Variables. UTF_FULLFN="${2}" - UTF_FULLFN_TZ="$(translateFULLFNWithTz ${UTF_FULLFN})" FTP_DIR_HOUR="$(lparentdir ${UTF_FULLFN})" - FTP_DIR_HOUR_TZ="$(lparentdir ${UTF_FULLFN_TZ})" # if [ "${SKIP_UPLOAD_TO_FTP}" = "1" ]; then logAdd "[INFO] uploadToFtp skipped due to SKIP_UPLOAD_TO_FTP == 1." @@ -197,9 +195,8 @@ uploadToFtp () if [ "${FTP_DIR_TREE}" == "yes" ]; then if [ ! -z "${FTP_DIR_HOUR}" ]; then # Create hour directory on FTP server - echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}/${FTP_DIR_HOUR_TZ}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR_HOUR}" + echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}/${FTP_DIR_HOUR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR_HOUR}" FTP_DIR_HOUR="${FTP_DIR_HOUR}/" - FTP_DIR_HOUR_TZ="${FTP_DIR_HOUR_TZ}/" fi fi # @@ -209,12 +206,12 @@ uploadToFtp () fi # if [ "${FTP_DIR_TREE}" == "yes" ]; then - if ( ! ftpput -u "${FTP_USERNAME}" -p "${FTP_PASSWORD}" "${FTP_HOST}" "${FTP_DIR}${FTP_DIR_HOUR_TZ}$(lbasename "${UTF_FULLFN_TZ}")" "${UTF_FULLFN}" ); then + if ( ! ftpput -u "${FTP_USERNAME}" -p "${FTP_PASSWORD}" "${FTP_HOST}" "${FTP_DIR}${FTP_DIR_HOUR}$(lbasename "${UTF_FULLFN}")" "${UTF_FULLFN}" ); then logAdd "[ERROR] uploadToFtp: ftpput FAILED." return 1 fi else - if ( ! ftpput -u "${FTP_USERNAME}" -p "${FTP_PASSWORD}" "${FTP_HOST}" "${FTP_DIR}$(lbasename "${UTF_FULLFN_TZ}")" "${UTF_FULLFN}" ); then + if ( ! ftpput -u "${FTP_USERNAME}" -p "${FTP_PASSWORD}" "${FTP_HOST}" "${FTP_DIR}$(lbasename "${UTF_FULLFN}")" "${UTF_FULLFN}" ); then logAdd "[ERROR] uploadToFtp: ftpput FAILED." return 1 fi