Chathing curl error, debug log path setup

develop
Dominik Dzienia 3 weeks ago
parent 6830b2c677
commit 793af6b394

@ -33,6 +33,7 @@ parse_commandline_args() {
UPDATE_CHANNEL=develop UPDATE_CHANNEL=develop
forceUpdateCheck=1 forceUpdateCheck=1
echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE" echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE"
update_logto
shift shift
;; ;;
-p | --production) -p | --production)
@ -40,6 +41,7 @@ parse_commandline_args() {
UPDATE_CHANNEL=master UPDATE_CHANNEL=master
forceUpdateCheck=1 forceUpdateCheck=1
echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE" echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE"
update_logto
shift shift
;; ;;
-u | --update) -u | --update)
@ -60,6 +62,7 @@ parse_commandline_args() {
warn "Switching to $UPDATE_CHANNEL_CANDIDATE update channel" warn "Switching to $UPDATE_CHANNEL_CANDIDATE update channel"
UPDATE_CHANNEL="$UPDATE_CHANNEL_CANDIDATE" UPDATE_CHANNEL="$UPDATE_CHANNEL_CANDIDATE"
echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE" echo "$UPDATE_CHANNEL" >"$UPDATE_CHANNEL_FILE"
update_logto
shift shift
;; ;;
--) --)

@ -7,7 +7,8 @@
REQUIRED_NODE_VERSION=18.0.0 REQUIRED_NODE_VERSION=18.0.0
REQUIRED_DOTENV_VERSION=1.3.0 REQUIRED_DOTENV_VERSION=1.3.0
LOGTO=/srv/nightscout/data/debug.log LOGTO=/dev/null
DEBUG_LOG_FILE=/srv/nightscout/data/debug.log
NIGHTSCOUT_ROOT_DIR=/srv/nightscout NIGHTSCOUT_ROOT_DIR=/srv/nightscout
CONFIG_ROOT_DIR=/srv/nightscout/config CONFIG_ROOT_DIR=/srv/nightscout/config
DATA_ROOT_DIR=/srv/nightscout/data DATA_ROOT_DIR=/srv/nightscout/data

@ -2,6 +2,14 @@
# APP LOGIC # APP LOGIC
#======================================= #=======================================
update_logto() {
if [[ "$UPDATE_CHANNEL" == "develop" ]]; then
LOGTO="$DEBUG_LOG_FILE"
else
LOGTO=/dev/null
fi
}
get_td_domain() { get_td_domain() {
local MHOST=$(hostname) local MHOST=$(hostname)
if ! [[ "$MHOST" =~ [a-zA-Z]{2,16}[0-9]{3} ]]; then if ! [[ "$MHOST" =~ [a-zA-Z]{2,16}[0-9]{3} ]]; then
@ -29,6 +37,7 @@ load_update_channel() {
if [[ -f $UPDATE_CHANNEL_FILE ]]; then if [[ -f $UPDATE_CHANNEL_FILE ]]; then
UPDATE_CHANNEL=$(cat "$UPDATE_CHANNEL_FILE") UPDATE_CHANNEL=$(cat "$UPDATE_CHANNEL_FILE")
msgok "Loaded update channel: $UPDATE_CHANNEL" msgok "Loaded update channel: $UPDATE_CHANNEL"
update_logto
fi fi
} }

@ -28,12 +28,12 @@ download_file() {
local url=$(get_url_branch "$branch" "$path") local url=$(get_url_branch "$branch" "$path")
if ! curl -fsSL -o "$target" "$url"; then if ! curl -fsSL -o "$target" "$url" 2>>"$LOGTO"; then
if [[ -z "$GITHUB_UNAVAILABLE" ]]; then if [[ -z "$GITHUB_UNAVAILABLE" ]]; then
mark_github_unavailable mark_github_unavailable
url=$(get_url_branch "$branch" "$path") url=$(get_url_branch "$branch" "$path")
ohai "GitHub failed, retrying with Gitea ($label)..." ohai "GitHub failed, retrying with Gitea ($label)..."
curl -fsSL -o "$target" "$url" curl -fsSL -o "$target" "$url" 2>>"$LOGTO"
else else
return 1 return 1
fi fi
@ -91,13 +91,13 @@ download_updates() {
ohai "Downloading updated scripts and config files" ohai "Downloading updated scripts and config files"
local url=$(get_url "updated") local url=$(get_url "updated")
local onlineUpdated=$(curl -fsSL "$url") local onlineUpdated=$(curl -fsSL "$url" 2>>"$LOGTO")
if [[ -z "$onlineUpdated" && -z "$GITHUB_UNAVAILABLE" ]]; then if [[ -z "$onlineUpdated" && -z "$GITHUB_UNAVAILABLE" ]]; then
mark_github_unavailable mark_github_unavailable
url=$(get_url "updated") url=$(get_url "updated")
ohai "GitHub failed, retrying with Gitea (update check)..." ohai "GitHub failed, retrying with Gitea (update check)..."
onlineUpdated=$(curl -fsSL "$url") onlineUpdated=$(curl -fsSL "$url" 2>>"$LOGTO")
fi fi
if [ ! "$onlineUpdated" == "" ]; then if [ ! "$onlineUpdated" == "" ]; then
@ -122,13 +122,13 @@ download_if_needed() {
echo "$timestampNow" >"$UPDATES_DIR/timestamp" echo "$timestampNow" >"$UPDATES_DIR/timestamp"
ohai "Checking if new version is available..." ohai "Checking if new version is available..."
local url=$(get_url "updated") local url=$(get_url "updated")
local onlineUpdated=$(curl -fsSL "$url") local onlineUpdated=$(curl -fsSL "$url" 2>>"$LOGTO")
if [[ -z "$onlineUpdated" && -z "$GITHUB_UNAVAILABLE" ]]; then if [[ -z "$onlineUpdated" && -z "$GITHUB_UNAVAILABLE" ]]; then
mark_github_unavailable mark_github_unavailable
url=$(get_url "updated") url=$(get_url "updated")
ohai "GitHub failed, retrying with Gitea (version check)..." ohai "GitHub failed, retrying with Gitea (version check)..."
onlineUpdated=$(curl -fsSL "$url") onlineUpdated=$(curl -fsSL "$url" 2>>"$LOGTO")
fi fi
local lastDownload=$(read_or_default "$UPDATES_DIR/downloaded") local lastDownload=$(read_or_default "$UPDATES_DIR/downloaded")

Loading…
Cancel
Save