--- mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in 2015/09/14 10:01:10 2513 +++ mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in 2015/09/14 10:29:34 2514 @@ -2,35 +2,50 @@ MCORE_LIBDIR="@@MCORE_LIBDIR@@" source @@SYSCONFDIR@@/mcore/mcore.conf +source @@SYSCONFDIR@@/mcore/citrix.conf source ${MCORE_LIBDIR}/include/common.global.class -source ${MCORE_LIBDIR}/include/daemon.global.class +#source ${MCORE_LIBDIR}/include/daemon.global.class +source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class -if [ ! -d ~/.ICAClient ] -then - install -d ~/.ICAClient -fi +: ${STOREFRONT_STORE=""} +: ${STOREFRONT_USER=""} +: ${STOREFRONT_PASS=""} +: ${STOREFRONT_DOMAIN=""} -if [ ! -f ~/.ICAClient ] +# get default store +if [[ -z ${STOREFRONT_STORE} ]] then - touch ~/.ICAClient/.eula_accepted + export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}" fi if ! storebrowse > /dev/null then - if [ -d ~/.ICAClient/.tmp ] + if [ -d ~/.ICAClient ] then - rm -r ~/ICAClient/.tmp + rm -r ~/ICAClient fi + install -d ~/.ICAClient + touch ~/.ICAClient/.eula_accepted + # kill running instances pidof AuthServiceDaemon > /dev/null && killall AuthServiceDaemon pidof ServiceRecord > /dev/null && killall ServiceRecord pidof storebrowse > /dev/null && killall storebrowse - # register eula - xvfb-run -a -s "-extension RANDR" storebrowse + # register eula and add default store + xvfb-run -a -s "-extension RANDR" storebrowse -a "${STOREFRONT_STORE}" fi -# get all sessions of default store -export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}" -${MCORE_LIBDIR}/storefront-resolver +# get all sessions +if [[ -z $(storebrowse -l | grep -i ${STOREFRONT_STORE}) ]] +then + echo "Store ${STOREFRONT_STORE} unknown, perhaps not added. Run 'rm -r ~/.ICAClient'." +else + OPT="" + [[ -n ${STOREFRONT_USER} ]] && OPT+=" -U \"${STOREFRONT_USER}\"" + [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P \"${STOREFRONT_PASS}\"" + [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D \"${STOREFRONT_DOMAIN}\"" + SESSION_LIST="$(storebrowse -E ${OPT} ${STOREFRONT_STORE})" + echo "${SESSION_LIST}" +fi