From: Jérôme Benoit Date: Wed, 3 Sep 2025 17:01:00 +0000 (+0200) Subject: refactor: ensure POSIX compliance X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=abc8d7d2c08db65a27be71e80f90ae4a708b3e0b;p=freqai-strategies.git refactor: ensure POSIX compliance Signed-off-by: Jérôme Benoit --- diff --git a/scripts/docker-upgrade.sh b/scripts/docker-upgrade.sh index 604b0c8..98a5cfe 100755 --- a/scripts/docker-upgrade.sh +++ b/scripts/docker-upgrade.sh @@ -15,7 +15,7 @@ if [ -f "$LOCKFILE" ]; then echo_timestamped "Error: already running for ${LOCAL_DOCKER_IMAGE}" exit 1 fi -trap 'rm -f "$LOCKFILE"' EXIT +trap 'rm -f "$LOCKFILE"' 0 HUP INT TERM touch "$LOCKFILE" jsonc_to_json() { @@ -80,7 +80,7 @@ jsonc_to_json() { } escape_telegram_markdown() { - printf '%s' "$1" | sed \ + printf '%s' "$1" | command sed \ -e 's/\\/\\\\/g' \ -e 's/[][(){}.*_~`>#\+=|.!-]/\\&/g' } @@ -93,13 +93,18 @@ send_telegram_message() { freqtrade_telegram_enabled=$(printf '%s' "$FREQTRADE_CONFIG_JSON" | jq -r '.telegram.enabled // "false"' 2>/dev/null || echo "false") if [ "$freqtrade_telegram_enabled" = "false" ]; then - return 0 + return 0 + fi + + if ! command -v curl >/dev/null 2>&1; then + echo_timestamped "Error: curl not found, cannot send telegram notification" + return 1 fi telegram_message=$(escape_telegram_markdown "$1") if [ -z "$telegram_message" ]; then - echo_timestamped "Error: message variable is empty" - return 1 + echo_timestamped "Error: message variable is empty" + return 1 fi freqtrade_telegram_token=$(printf '%s' "$FREQTRADE_CONFIG_JSON" | jq -r '.telegram.token // ""' 2>/dev/null || echo "")