Commit 79c1bd86 authored by Paul Cammish's avatar Paul Cammish
Browse files

Basic structure

parent 575c842b
#!/bin/bash
touch /dev/shm/sympl-tests
wall "`date`"
set -e
set -o pipefail
if [ "$( echo "$@" | grep -c '\-\-debug' )" != "0" ]; then DEBUG="true" ; fi
##############################################################################
# Output Functions #
##############################################################################
_debug() {
if [ $DEBUG ]; then
echo -e "\033[2mDEBUG: $@\033[0m"
fi
}
_warn() {
echo -e "\033[1m\033[33m WARN: \033[0m $@"
}
_error() {
echo -e "\033[1m\033[31mERROR: \033[0m $@"
exit 1
}
_echo() {
if [ $DEBUG ]; then
echo " INFO: $@"
elif [ $VERBOSE ]; then
echo "$@"
fi
}
#############################################################################
# Set Defaults #
#############################################################################
TIMESTAMP="$(date +%s)"
TEST_PATH="$(dirname $0)"
VERBOSE=true
LOG="/tmp/sympl-tests.log"
#############################################################################
# Read Command Line Parameters #
#############################################################################
_debug "Command line parameters: $@"
PARAMETERS=()
while [ $# -gt 0 ]; do
key="$1"
case $key in
--all|-a)
ALL=true
shift
;;
--log|-l)
LOG="$2"
shift ; shift
;;
--path)
TEST_PATH="$2"
shift ; shift
;;
--cron)
unset VERBOSE
shift
;;
--quiet)
unset VERBOSE
QUIET=true
shift
;;
*) # unhandled parameter
PARAMETERS+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
_debug "Command line variables:
------------------------------------------
UNKNOWN |$PARAMETERS
VERBOSE |$VERBOSE
LOG |$LOG
TEST_PATH |$TEST_PATH
DEBUG |$DEBUG
"
TIMESTAMP="$(date +%s)"
_echo "Starting run at $(date ; if [ "$TEST_PATH" != "." ] ; then echo ", test path: '$TEST_PATH'" ; fi )"
* * * * * root cd /root/sympl-tests/ ; git pull ; /usr/bin/flock -n 3 /root/sympl-tests/sympl-tests --all
* * * * * root cd /root/sympl-tests/ ; git pull ; /usr/bin/flock -n 3 /root/sympl-tests/sympl-tests --cron --all
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment