From e30dc0707226922e2d1b33dc7c0fce10d5dbcd94 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 20 Feb 2017 19:16:20 +0800 Subject: [PATCH 01/14] Server - Fix MIFARE auth --- src/server/server.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/server/server.c b/src/server/server.c index 0f254b9..76b3b44 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -94,6 +94,9 @@ void Debug(tClient *Client, const char *Format, ...); int Server_int_ParseArgs(int bUseLongArg, char *ArgStr, ...); int Server_int_ParseFlags(tClient *Client, const char *Str, int *Mask, int *Value); +#define CLIENT_DEBUG_LOW(Client, ...) do { if(giDebugLevel>1) Debug(Client, __VA_ARGS__); } while(0) +#define CLIENT_DEBUG(Client, ...) do { if(giDebugLevel) Debug(Client, __VA_ARGS__); } while(0) + // === CONSTANTS === // - Commands const struct sClientCommand { @@ -663,8 +666,8 @@ void Server_Cmd_AUTHCARD(tClient* Client, char *Args) return ; } - // Check if trusted - if( Client->UID != 0 ) + // Check if trusted (has to be root) + if( Client->UID != 1 ) { if(giDebugLevel) Debug(Client, "Attempting to use AUTHCARD as non-root"); @@ -672,6 +675,7 @@ void Server_Cmd_AUTHCARD(tClient* Client, char *Args) return ; } + CLIENT_DEBUG(Client, "MIFARE auth with '%s'", card_id); int uid = Bank_GetAcctByCard(card_id); if( uid < 0 ) { @@ -1651,9 +1655,8 @@ void Server_Cmd_PINSET(tClient *Client, char *Args) if(!require_auth(Client)) return; - int uid = Client->EffectiveUID; - if(uid == -1) - uid = Client->UID; + int uid = Client->EffectiveUID > 0 ? Client->EffectiveUID : Client->UID; + CLIENT_DEBUG(Client, "Setting PIN for UID %i", uid); // Can only pinset yourself (well, the effective user) Bank_SetPin(uid, pin); sendf(Client->Socket, "200 Pin updated\n"); @@ -1669,7 +1672,9 @@ void Server_Cmd_CARDADD(tClient* Client, char* Args) if(!require_auth(Client)) return; - if( Bank_AddAcctCard(Client->UID, card_id) ) + int uid = Client->EffectiveUID > 0 ? Client->EffectiveUID : Client->UID; + CLIENT_DEBUG(Client, "Add card '%s' to UID %i", card_id, uid); + if( Bank_AddAcctCard(uid, card_id) ) { sendf(Client->Socket, "408 Card already exists\n"); return ; -- 2.20.1 From 0de1e8b33b746fa512d7ced5f5ef986c3b9b7dae Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 14:32:54 +0800 Subject: [PATCH 02/14] tests - Tweak tests in preparation for attempted CI --- tests/TEST_basic.sh | 10 ++++++++-- tests/_common.sh | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/TEST_basic.sh b/tests/TEST_basic.sh index f2f1301..dccdc6d 100755 --- a/tests/TEST_basic.sh +++ b/tests/TEST_basic.sh @@ -4,17 +4,23 @@ TESTNAME=basic . _common.sh -if $DISPENSE acct tpg; then +# Ensure that the databse doesn't already contain the current user +# - 1. Protects against running the test against the production database +# - 2. Allows adding the current user as an admin +if $DISPENSE acct "$USER"; then FAIL "Database contains '$USER'" fi - +# Add the current user as an admin sqlite3 "${BASEDIR}cokebank.db" "INSERT INTO accounts (acct_name,acct_is_admin,acct_uid) VALUES ('${USER}',1,1);" +# Try to add a new user TRY_COMMAND "$DISPENSE user add unittest_user0" +# Ensure that the add worked LOG "Checking for test user" TRY_COMMAND $DISPENSE acct unittest_user0 | grep ': $ 0.00' +# Manipulate user's balance TRY_COMMAND $DISPENSE acct unittest_user0 +100 Unit_test TRY_COMMAND $DISPENSE acct unittest_user0 | grep ': $ 1.00' TRY_COMMAND $DISPENSE acct unittest_user0 -100 Unit_test diff --git a/tests/_common.sh b/tests/_common.sh index 0019b99..4058bb5 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -1,10 +1,13 @@ - +# +# NOTE: Not a script, to be included by scripts +# BASEDIR=rundir/${TESTNAME}/ PORT=22222 mkdir -p ${BASEDIR} rm -f ${BASEDIR}cokebank.db +# Template configuration (disables door and the coke machine) cat << EOF > ${BASEDIR}cfg_server.conf # AUTOGENERATED Test ${TESTNAME} server_port ${PORT} -- 2.20.1 From f892fc21d4ac919b09c1ccf0c48c6ecf12b41f0d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 06:34:10 +0000 Subject: [PATCH 03/14] Add .gitlab-ci.yml --- .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c2ad740 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +# This file is a template, and might need editing before it works on your project. +# use the official gcc image, based on debian +# can use verions as well, like gcc:5.2 +# see https://hub.docker.com/_/gcc/ +image: gcc + +build: + stage: build + # instead of calling g++ directly you can also use some build toolkit like make + # install the necessary build tools when needed + # before_script: + # - apt update && apt -y install make autoconf + script: + - make -C src/ + artifacts: + paths: + - dispense + - cokebank_sqlite.so + - dispsrc + # depending on your build setup it's most likely a good idea to cache outputs to reduce the build time + # cache: + # paths: + # - "*.o" + +# run tests using the binary built before +test: + stage: test + script: + - cd tests && ./TEST_basic.sh -- 2.20.1 From 654d09f81b092af24d4ef096992451ffb0f173a4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 14:42:12 +0800 Subject: [PATCH 04/14] Gitlab CI - Add libraries --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2ad740..18b003c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,8 @@ build: stage: build # instead of calling g++ directly you can also use some build toolkit like make # install the necessary build tools when needed - # before_script: - # - apt update && apt -y install make autoconf + before_script: + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev script: - make -C src/ artifacts: -- 2.20.1 From 0fb8990b502398a1d2316cb9a67bdf4bb0bde7ee Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 14:47:27 +0800 Subject: [PATCH 05/14] Gitlab CI - Fix tests (using `nc`) --- .gitlab-ci.yml | 4 ++-- tests/_common.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 18b003c..bbfd057 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,14 +9,14 @@ build: # instead of calling g++ directly you can also use some build toolkit like make # install the necessary build tools when needed before_script: - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev netcat script: - make -C src/ artifacts: paths: - dispense - cokebank_sqlite.so - - dispsrc + - dispsrv # depending on your build setup it's most likely a good idea to cache outputs to reduce the build time # cache: # paths: diff --git a/tests/_common.sh b/tests/_common.sh index 4058bb5..cb31ac7 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -46,10 +46,15 @@ server_pid=$! cleanup() { LOG "Killing ${server_pid}" - kill ${server_pid} + kill ${server_pid}; true } trap cleanup EXIT LOG "Server running on PID ${server_pid}" sleep 1 -echo "" | nc localhost ${PORT} +# - Make sure that the server started +if ! (echo "" | nc localhost ${PORT}); then + LOG "Server not responding on ${PORT}" + LOG "Server log contents:" + cat ${BASEDIR}server.log +fi -- 2.20.1 From 674c5c0b50247a280a5e6ab0ce1c252579db6407 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 14:57:16 +0800 Subject: [PATCH 06/14] Gitlab CI - Fix tests (take 2) --- .gitlab-ci.yml | 4 +++- tests/TEST_basic.sh | 2 +- tests/_common.sh | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bbfd057..c16ff8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ build: # instead of calling g++ directly you can also use some build toolkit like make # install the necessary build tools when needed before_script: - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev netcat + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev script: - make -C src/ artifacts: @@ -25,5 +25,7 @@ build: # run tests using the binary built before test: stage: test + before_script: + - apt update && apt -y install libncurses libmodbus libsqlite3 libident netcat script: - cd tests && ./TEST_basic.sh diff --git a/tests/TEST_basic.sh b/tests/TEST_basic.sh index dccdc6d..481e119 100755 --- a/tests/TEST_basic.sh +++ b/tests/TEST_basic.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -eux +set -eu TESTNAME=basic . _common.sh diff --git a/tests/_common.sh b/tests/_common.sh index cb31ac7..fa2f107 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -1,6 +1,7 @@ # # NOTE: Not a script, to be included by scripts # +USER=$(id -un) BASEDIR=rundir/${TESTNAME}/ PORT=22222 @@ -34,6 +35,7 @@ FAIL() { } TRY_COMMAND() { cmd="$*" + echo ">> $cmd" if ! $cmd ; then FAIL "Command \`$cmd\` failed" fi @@ -45,8 +47,12 @@ LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise > ${ server_pid=$! cleanup() { - LOG "Killing ${server_pid}" - kill ${server_pid}; true + if pidof dispsrv | grep ${server_pid}; then + LOG "Killing ${server_pid}" + kill ${server_pid}; true + else + LOG "Server already terminated" + fi } trap cleanup EXIT @@ -57,4 +63,5 @@ if ! (echo "" | nc localhost ${PORT}); then LOG "Server not responding on ${PORT}" LOG "Server log contents:" cat ${BASEDIR}server.log + exit 1 fi -- 2.20.1 From 4a5968db77587c2a6d8a25901c0943e25bb39613 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 15:00:11 +0800 Subject: [PATCH 07/14] Gitlab CI - Install libraries for test properly --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c16ff8e..da4f6c6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ build: test: stage: test before_script: - - apt update && apt -y install libncurses libmodbus libsqlite3 libident netcat + # Install the -dev versions to avoid needing to find the actual library names + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat script: - cd tests && ./TEST_basic.sh -- 2.20.1 From 4848b3853ef5517c4da4f2bcd6c8b959dae33411 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 15:08:09 +0800 Subject: [PATCH 08/14] tests - Support running as `root` (for CI) --- tests/TEST_basic.sh | 21 ++++++++++++++------- tests/_common.sh | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/TEST_basic.sh b/tests/TEST_basic.sh index 481e119..76c6490 100755 --- a/tests/TEST_basic.sh +++ b/tests/TEST_basic.sh @@ -4,14 +4,21 @@ TESTNAME=basic . _common.sh -# Ensure that the databse doesn't already contain the current user -# - 1. Protects against running the test against the production database -# - 2. Allows adding the current user as an admin -if $DISPENSE acct "$USER"; then - FAIL "Database contains '$USER'" +# (CI runs as root, and root is auto-added by databse creation) +if [[ "$USER" -ne "root" ]]; then + # Ensure that the databse doesn't already contain the current user + # - 1. Protects against running the test against the production database + # - 2. Allows adding the current user as an admin + if $DISPENSE acct "$USER"; then + FAIL "Database contains '$USER'" + fi + # Add the current user as an admin + sqlite3 "${BASEDIR}cokebank.db" "INSERT INTO accounts (acct_name,acct_is_admin,acct_uid) VALUES ('${USER}',1,1);" +else + if $DISPENSE acct accmurph; then + FAIL "Database contains 'accmurph' (running as root, might be using prodution)" + fi fi -# Add the current user as an admin -sqlite3 "${BASEDIR}cokebank.db" "INSERT INTO accounts (acct_name,acct_is_admin,acct_uid) VALUES ('${USER}',1,1);" # Try to add a new user TRY_COMMAND "$DISPENSE user add unittest_user0" diff --git a/tests/_common.sh b/tests/_common.sh index fa2f107..04d1657 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -41,13 +41,13 @@ TRY_COMMAND() { fi } -DISPENSE="../dispense -H localhost -P ${PORT}" +DISPENSE="../dispense -f /dev/null -H localhost -P ${PORT}" LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise > ${BASEDIR}server.log 2>&1 & server_pid=$! cleanup() { - if pidof dispsrv | grep ${server_pid}; then + if pidof dispsrv | grep ${server_pid} > /dev/null; then LOG "Killing ${server_pid}" kill ${server_pid}; true else -- 2.20.1 From 067245e37fea88320ad8b431b4410ae384fc1f32 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 19 Sep 2021 15:13:05 +0800 Subject: [PATCH 09/14] Tests - Tweak to the running-as-root check --- tests/TEST_basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TEST_basic.sh b/tests/TEST_basic.sh index 76c6490..d128f8d 100755 --- a/tests/TEST_basic.sh +++ b/tests/TEST_basic.sh @@ -5,7 +5,7 @@ TESTNAME=basic . _common.sh # (CI runs as root, and root is auto-added by databse creation) -if [[ "$USER" -ne "root" ]]; then +if [[ "x$USER" != "xroot" ]]; then # Ensure that the databse doesn't already contain the current user # - 1. Protects against running the test against the production database # - 2. Allows adding the current user as an admin -- 2.20.1 From 3c03884844384020aac5a789aa36a1453bf57b78 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 11 Oct 2021 20:10:37 +0800 Subject: [PATCH 10/14] Gitlab CI - Attempt to create+use a non-root user --- .gitlab-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da4f6c6..7e86b2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,6 +27,7 @@ test: stage: test before_script: # Install the -dev versions to avoid needing to find the actual library names - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 + - useradd testuser && chown -R testuser . script: - - cd tests && ./TEST_basic.sh + - cd tests && su -l -c './TEST_basic.sh' testuser -- 2.20.1 From 1383ba77ec33e94ab104aa2d6bc0c27ec8931727 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 11 Oct 2021 20:45:30 +0800 Subject: [PATCH 11/14] Tests - Tweaking --- .gitlab-ci.yml | 2 +- tests/TEST_basic.sh | 17 ++--------------- tests/_common.sh | 13 +++++++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e86b2c..c46648c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,4 +30,4 @@ test: - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 - useradd testuser && chown -R testuser . script: - - cd tests && su -l -c './TEST_basic.sh' testuser + - cd tests && su -c './TEST_basic.sh' testuser diff --git a/tests/TEST_basic.sh b/tests/TEST_basic.sh index d128f8d..4636930 100755 --- a/tests/TEST_basic.sh +++ b/tests/TEST_basic.sh @@ -4,21 +4,8 @@ TESTNAME=basic . _common.sh -# (CI runs as root, and root is auto-added by databse creation) -if [[ "x$USER" != "xroot" ]]; then - # Ensure that the databse doesn't already contain the current user - # - 1. Protects against running the test against the production database - # - 2. Allows adding the current user as an admin - if $DISPENSE acct "$USER"; then - FAIL "Database contains '$USER'" - fi - # Add the current user as an admin - sqlite3 "${BASEDIR}cokebank.db" "INSERT INTO accounts (acct_name,acct_is_admin,acct_uid) VALUES ('${USER}',1,1);" -else - if $DISPENSE acct accmurph; then - FAIL "Database contains 'accmurph' (running as root, might be using prodution)" - fi -fi +TRY_COMMAND "$DISPENSE acct ${USER}" +TRY_COMMAND "$DISPENSE pseudo:0" # Try to add a new user TRY_COMMAND "$DISPENSE user add unittest_user0" diff --git a/tests/_common.sh b/tests/_common.sh index 04d1657..e43a2c8 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -25,6 +25,7 @@ coke_dummy_mode yes EOF echo "# AUTOGENERATED Test ${TESTNAME}" > ${BASEDIR}cfg_items.conf +echo "pseudo 0 0 Test item" >> ${BASEDIR}cfg_items.conf LOG() { echo "TEST ${TESTNAME}: "$* @@ -65,3 +66,15 @@ if ! (echo "" | nc localhost ${PORT}); then cat ${BASEDIR}server.log exit 1 fi + +if [[ "x$USER" == "xroot" ]]; then + FAIL "Running as root" +fi +# Ensure that the database doesn't already contain the current user +# - 1. Protects against running the test against the production database +# - 2. Allows adding the current user as an admin +if $DISPENSE acct "${USER}" 2> /dev/null; then + FAIL "Database contains '$USER', are you running on production?" +fi +# Add the current user as an admin +sqlite3 "${BASEDIR}cokebank.db" "INSERT INTO accounts (acct_name,acct_is_admin,acct_uid) VALUES ('${USER}',1,1);" -- 2.20.1 From 26262e4bd6dd8ce3126957788bb78ee37c0dde39 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 11 Oct 2021 20:49:36 +0800 Subject: [PATCH 12/14] Gitlab CI - Add `oidentd` package --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c46648c..72fc89a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,7 @@ test: stage: test before_script: # Install the -dev versions to avoid needing to find the actual library names - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 oidentd - useradd testuser && chown -R testuser . script: - cd tests && su -c './TEST_basic.sh' testuser -- 2.20.1 From 51933a63039ddd15179c57bbd3518e024c0f6e0f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 11 Oct 2021 20:55:21 +0800 Subject: [PATCH 13/14] Gitlab CI - SETUID for autoauth --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 72fc89a..6f6de61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,7 +27,9 @@ test: stage: test before_script: # Install the -dev versions to avoid needing to find the actual library names - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 oidentd + - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident netcat sqlite3 - useradd testuser && chown -R testuser . + # SETUID on the client, so it can use AUTOAUTH (ident doesn't work on the container) + - chmod u+s dispense script: - cd tests && su -c './TEST_basic.sh' testuser -- 2.20.1 From 45c8529b136d8a78a1f7e6059db3a868b9616fe4 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 18 Oct 2021 20:54:23 +0800 Subject: [PATCH 14/14] Gitlab CI - Debugging --- .gitlab-ci.yml | 6 +++++- tests/_common.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6f6de61..49af60d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,8 @@ build: # instead of calling g++ directly you can also use some build toolkit like make # install the necessary build tools when needed before_script: - - apt update && apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev + - apt update + - apt -y install libncurses-dev libmodbus-dev libsqlite3-dev libident-dev script: - make -C src/ artifacts: @@ -33,3 +34,6 @@ test: - chmod u+s dispense script: - cd tests && su -c './TEST_basic.sh' testuser + artifacts: + paths: + - tests/rundir/** diff --git a/tests/_common.sh b/tests/_common.sh index e43a2c8..0f62430 100644 --- a/tests/_common.sh +++ b/tests/_common.sh @@ -44,7 +44,7 @@ TRY_COMMAND() { DISPENSE="../dispense -f /dev/null -H localhost -P ${PORT}" -LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise > ${BASEDIR}server.log 2>&1 & +LD_LIBRARY_PATH=.. ../dispsrv -f ${BASEDIR}cfg_server.conf --dont-daemonise -d 2 > ${BASEDIR}server.log 2>&1 & server_pid=$! cleanup() { -- 2.20.1