Skip to content

Instantly share code, notes, and snippets.

@mtholder
Created August 9, 2018 18:22
Show Gist options
  • Select an option

  • Save mtholder/5012eec24687bd79a99b5757b2e32765 to your computer and use it in GitHub Desktop.

Select an option

Save mtholder/5012eec24687bd79a99b5757b2e32765 to your computer and use it in GitHub Desktop.
cron-executable script (no output except in case of failure) for testing Open Tree services
#!/bin/bash
PAR_DIR=/home/mholder
TEST_OT_DIR="${PAR_DIR}/test-ot-ws"
TEST_LOG_DIR="${PAR_DIR}/testotlogs"
source "${PAR_DIR}/env/test-otc-ws/bin/activate" || exit
source "${TEST_OT_DIR}/dev/activate.sh" || exit
cd "${TEST_OT_DIR}" || exit
date > "${TEST_LOG_DIR}/latest.log"
nf=0
if ! git pull origin >> "${TEST_LOG_DIR}/latest.log" 2>&1 ; then
nf=1
fi
if ! test-ot-ws --threads=1 --api-version=v3 >> "${TEST_LOG_DIR}/latest.log" 2>&1 ; then
nf=1
fi
cat "${TEST_LOG_DIR}/latest.log" >> "${TEST_LOG_DIR}/recent.log"
if ! test $nf -eq 0 ; then
echo Open Tree Services Failing > "${TEST_LOG_DIR}/emailmessage.txt"
cat "${TEST_LOG_DIR}/latest.log" >> "${TEST_LOG_DIR}/emailmessage.txt"
cat "${TEST_LOG_DIR}/emailmessage.txt"
exit 1
fi
@mtholder
Copy link
Author

mtholder commented Aug 9, 2018

Tested with a python 3.7.0 virtualenv and the executable from https://github.com/OpenTreeOfLife/test-ot-ws as the testing script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment