2016-04-01 12:20:23 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. /etc/zaf.conf
|
2016-04-01 15:51:45 +02:00
|
|
|
|
|
|
|
[ -z "$ZAF_TMP_BASE" ] && ZAF_TMP_BASE=/tmp/zaf
|
|
|
|
ZAF_TMP_DIR="${ZAF_TMP_BASE}-${USER}"
|
2016-04-12 18:38:19 +02:00
|
|
|
[ -z "$ZAF_CACHE_DIR" ] && ZAF_CACHE_DIR=${ZAF_TMP_BASE}-${USER}c
|
|
|
|
|
|
|
|
#trap "rm -rif ${ZAF_TMP_DIR}" EXIT
|
2016-04-01 15:51:45 +02:00
|
|
|
! [ -d "${ZAF_TMP_DIR}" ] && mkdir "${ZAF_TMP_DIR}"
|
2016-04-12 18:38:19 +02:00
|
|
|
! [ -d "${ZAF_CACHE_DIR}" ] && mkdir "${ZAF_CACHE_DIR}"
|
2016-04-01 15:51:45 +02:00
|
|
|
[ -z "$ZAF_DEBUG" ] && ZAF_DEBUG=1
|
|
|
|
|
2016-04-01 12:20:23 +02:00
|
|
|
. ${ZAF_LIB_DIR}/zaf.lib.sh
|
2016-04-01 15:51:45 +02:00
|
|
|
. ${ZAF_LIB_DIR}/ctrl.lib.sh
|
|
|
|
. ${ZAF_LIB_DIR}/os.lib.sh
|
2016-04-12 18:38:19 +02:00
|
|
|
. ${ZAF_LIB_DIR}/zbxapi.lib.sh
|
|
|
|
. ${ZAF_LIB_DIR}/cache.lib.sh
|
2016-04-01 15:51:45 +02:00
|
|
|
|
|
|
|
export ZAF_LIB_DIR
|
|
|
|
export ZAF_TMP_DIR
|
|
|
|
export ZAF_PLUGINS_DIR
|
2016-04-01 12:20:23 +02:00
|
|
|
|
2016-04-12 18:38:19 +02:00
|
|
|
if [ "$1" = "_cache" ]; then
|
|
|
|
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
|
2016-04-01 12:20:23 +02:00
|
|
|
|
|
|
|
|