mirror of
https://github.com/limosek/zaf.git
synced 2024-11-14 06:29:07 +01:00
2a0d6848a7
Added testparameters and precacheparameters
38 lines
919 B
Bash
38 lines
919 B
Bash
#!/bin/sh
|
|
|
|
. /etc/zaf.conf
|
|
|
|
[ -z "$ZAF_TMP_BASE" ] && ZAF_TMP_BASE=/tmp/zaf
|
|
ZAF_TMP_DIR="${ZAF_TMP_BASE}-${USER}"
|
|
[ -z "$ZAF_CACHE_DIR" ] && ZAF_CACHE_DIR=${ZAF_TMP_BASE}c
|
|
|
|
trap "rm -rif ${ZAF_TMP_DIR}" EXIT
|
|
! [ -d "${ZAF_TMP_DIR}" ] && mkdir "${ZAF_TMP_DIR}"
|
|
! [ -d "${ZAF_CACHE_DIR}" ] && mkdir "${ZAF_CACHE_DIR}"
|
|
[ -z "$ZAF_DEBUG" ] && ZAF_DEBUG=1
|
|
|
|
. ${ZAF_LIB_DIR}/zaf.lib.sh
|
|
. ${ZAF_LIB_DIR}/ctrl.lib.sh
|
|
. ${ZAF_LIB_DIR}/os.lib.sh
|
|
. ${ZAF_LIB_DIR}/zbxapi.lib.sh
|
|
. ${ZAF_LIB_DIR}/cache.lib.sh
|
|
|
|
export ZAF_LIB_DIR
|
|
export ZAF_TMP_DIR
|
|
export ZAF_PLUGINS_DIR
|
|
|
|
if [ "$1" = "_cache" ] || [ "$1" = "_nocache" ] ; then
|
|
[ "$1" = "_nocache" ] && export ZAF_NOCACHE=1
|
|
shift
|
|
seconds=$1
|
|
shift
|
|
parms=$(echo $*|tr -d ' ')
|
|
if ! zaf_fromcache $parms; then
|
|
([ "$(basename $0)" = "preload.sh" ] && [ -n "$*" ] && $@ ) | zaf_tocache_stdin $parms $seconds
|
|
fi
|
|
else
|
|
[ "$(basename $0)" = "preload.sh" ] && [ -n "$*" ] && $@
|
|
fi
|
|
|
|
|