fix env variables
This commit is contained in:
parent
6a386f97e0
commit
0bc4e5f6f3
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# bash-refine v1.3.0: bash-refine.sh, Felix Lohmeier, 2020-07-31
|
# bash-refine v1.3.1: bash-refine.sh, Felix Lohmeier, 2020-07-31
|
||||||
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
||||||
# license: MIT License https://choosealicense.com/licenses/mit/
|
# license: MIT License https://choosealicense.com/licenses/mit/
|
||||||
|
|
||||||
|
@ -8,21 +8,29 @@
|
||||||
# ================================== CONFIG ================================== #
|
# ================================== CONFIG ================================== #
|
||||||
|
|
||||||
endpoint="${REFINE_ENDPOINT:-http://localhost:3333}"
|
endpoint="${REFINE_ENDPOINT:-http://localhost:3333}"
|
||||||
memory="${REFINE_MEMORY:-1400M}" # increase to available RAM
|
memory="${REFINE_MEMORY:-1400M}"
|
||||||
|
csrf="${REFINE_CSRF:-true}"
|
||||||
date="$(date +%Y%m%d_%H%M%S)"
|
date="$(date +%Y%m%d_%H%M%S)"
|
||||||
if [[ -z "${REFINE_WORKDIR}" ]]; then
|
if [[ -n "$(readlink -e "${REFINE_WORKDIR}")" ]]; then
|
||||||
workdir="output/${date}"
|
workdir="$(readlink -e "${REFINE_WORKDIR}")"
|
||||||
else
|
else
|
||||||
workdir="${REFINE_WORKDIR}"
|
workdir="$(readlink -m "${BASH_SOURCE%/*}/output/${date}")"
|
||||||
fi
|
fi
|
||||||
if [[ -z "${REFINE_LOGFILE}" ]]; then
|
if [[ -n "$(readlink -e "${REFINE_LOGFILE}")" ]]; then
|
||||||
logfile="log/${date}.log"
|
logfile="$(readlink -e "${REFINE_LOGFILE}")"
|
||||||
else
|
else
|
||||||
logfile="${REFINE_LOGFILE}"
|
logfile="$(readlink -m "${BASH_SOURCE%/*}/log/${date}.log")"
|
||||||
|
fi
|
||||||
|
if [[ -n "$(readlink -e "${REFINE_JQ}")" ]]; then
|
||||||
|
jq="$(readlink -e "${REFINE_JQ}")"
|
||||||
|
else
|
||||||
|
jq="$(readlink -m "${BASH_SOURCE%/*}/lib/jq")"
|
||||||
|
fi
|
||||||
|
if [[ -n "$(readlink -e "${REFINE_REFINE}")" ]]; then
|
||||||
|
refine="$(readlink -e "${REFINE_REFINE}")"
|
||||||
|
else
|
||||||
|
refine="$(readlink -m "${BASH_SOURCE%/*}/lib/openrefine/refine")"
|
||||||
fi
|
fi
|
||||||
csrf="${REFINE_CSRF:-true}" # set to false for OpenRefine < 3.3
|
|
||||||
jq="${REFINE_JQ:-jq}" # path to executable
|
|
||||||
refine="${REFINE_REFINE:-openrefine/refine}" # path to executable
|
|
||||||
|
|
||||||
declare -A checkpoints # associative array for stats
|
declare -A checkpoints # associative array for stats
|
||||||
declare -A pids # associative array for monitoring background jobs
|
declare -A pids # associative array for monitoring background jobs
|
||||||
|
@ -45,6 +53,7 @@ function requirements {
|
||||||
# download jq and OpenRefine if necessary
|
# download jq and OpenRefine if necessary
|
||||||
if [[ -z "$(readlink -e "${jq}")" ]]; then
|
if [[ -z "$(readlink -e "${jq}")" ]]; then
|
||||||
echo "Download jq..."
|
echo "Download jq..."
|
||||||
|
mkdir -p "$(dirname "${jq}")"
|
||||||
# jq 1.4 has much faster startup time than 1.5 and 1.6
|
# jq 1.4 has much faster startup time than 1.5 and 1.6
|
||||||
curl -L --output "${jq}" \
|
curl -L --output "${jq}" \
|
||||||
"https://github.com/stedolan/jq/releases/download/jq-1.4/jq-linux-x86_64"
|
"https://github.com/stedolan/jq/releases/download/jq-1.4/jq-linux-x86_64"
|
||||||
|
@ -76,7 +85,7 @@ function requirements {
|
||||||
function refine_start {
|
function refine_start {
|
||||||
echo "start OpenRefine server..."
|
echo "start OpenRefine server..."
|
||||||
local dir
|
local dir
|
||||||
dir="$(readlink -f "${workdir}")"
|
dir="$(readlink -e "${workdir}")"
|
||||||
${refine} -v warn -m "${memory}" -p "${endpoint##*:}" -d "${dir}" &
|
${refine} -v warn -m "${memory}" -p "${endpoint##*:}" -d "${dir}" &
|
||||||
pid_server=${!}
|
pid_server=${!}
|
||||||
timeout 30s bash -c "until curl -s \"${endpoint}\" \
|
timeout 30s bash -c "until curl -s \"${endpoint}\" \
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# bash-refine v1.3.0: minimal.sh, Felix Lohmeier, 2020-07-31
|
# bash-refine v1.3.1: minimal.sh, Felix Lohmeier, 2020-07-31
|
||||||
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
||||||
# license: MIT License https://choosealicense.com/licenses/mit/
|
# license: MIT License https://choosealicense.com/licenses/mit/
|
||||||
|
|
||||||
# =============================== ENVIRONMENT ================================ #
|
# =============================== ENVIRONMENT ================================ #
|
||||||
|
|
||||||
|
source "${BASH_SOURCE%/*}/bash-refine.sh" || exit 1
|
||||||
cd "${BASH_SOURCE%/*}/" || exit 1
|
cd "${BASH_SOURCE%/*}/" || exit 1
|
||||||
source bash-refine.sh
|
|
||||||
init
|
init
|
||||||
|
|
||||||
# ================================= STARTUP ================================== #
|
# ================================= STARTUP ================================== #
|
||||||
|
|
18
templates.sh
18
templates.sh
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# bash-refine v1.3.0: templates.sh, Felix Lohmeier, 2020-07-31
|
# bash-refine v1.3.1: templates.sh, Felix Lohmeier, 2020-07-31
|
||||||
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
# https://gist.github.com/felixlohmeier/d76bd27fbc4b8ab6d683822cdf61f81d
|
||||||
# license: MIT License https://choosealicense.com/licenses/mit/
|
# license: MIT License https://choosealicense.com/licenses/mit/
|
||||||
|
|
||||||
|
@ -13,21 +13,21 @@
|
||||||
|
|
||||||
# =============================== ENVIRONMENT ================================ #
|
# =============================== ENVIRONMENT ================================ #
|
||||||
|
|
||||||
|
# source the main script
|
||||||
|
source "${BASH_SOURCE%/*}/bash-refine.sh" || exit 1
|
||||||
|
|
||||||
# make script executable from another directory
|
# make script executable from another directory
|
||||||
cd "${BASH_SOURCE%/*}/" || exit 1
|
cd "${BASH_SOURCE%/*}/" || exit 1
|
||||||
|
|
||||||
# source the main script
|
|
||||||
source bash-refine.sh
|
|
||||||
|
|
||||||
### override default config?
|
### override default config?
|
||||||
#endpoint="http://localhost:3333"
|
#endpoint="http://localhost:3333"
|
||||||
#memory="1400M" # increase to available RAM
|
#memory="1400M" # increase to available RAM
|
||||||
#date="$(date +%Y%m%d_%H%M%S)"
|
|
||||||
#workdir="output/${date}"
|
|
||||||
#logfile="log/${date}.log"
|
|
||||||
#csrf=true # set to false for OpenRefine < 3.3
|
#csrf=true # set to false for OpenRefine < 3.3
|
||||||
#jq="jq" # path to executable
|
#date="$(date +%Y%m%d_%H%M%S)"
|
||||||
#refine="openrefine/refine" # path to executable
|
#workdir="${BASH_SOURCE%/*}/output/${date}"
|
||||||
|
#logfile="${BASH_SOURCE%/*}/log/${date}.log"
|
||||||
|
#jq="${BASH_SOURCE%/*}/lib/jq" # path to executable
|
||||||
|
#refine="${BASH_SOURCE%/*}/lib/openrefine/refine" # path to executable
|
||||||
|
|
||||||
# check requirements, set trap, create workdir and tee to logfile
|
# check requirements, set trap, create workdir and tee to logfile
|
||||||
init
|
init
|
||||||
|
|
Loading…
Reference in New Issue