--- mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in 2015/09/14 11:36:20 2518 +++ mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in 2015/09/14 12:12:48 2519 @@ -3,6 +3,7 @@ MCORE_LIBDIR="@@MCORE_LIBDIR@@" source @@SYSCONFDIR@@/mcore/mcore.conf source @@SYSCONFDIR@@/mcore/citrix.conf +source @@SYSCONFDIR@@/mcore/control.conf source ${MCORE_LIBDIR}/include/common.global.class source ${MCORE_LIBDIR}/include/daemon.global.class source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class @@ -47,9 +48,15 @@ [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P ${STOREFRONT_PASS}" [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D ${STOREFRONT_DOMAIN}" SESSION_LIST=$(storebrowse -E ${OPT} ${STOREFRONT_STORE}) + if [[ $? != 0 ]] + then + echo "could not retrieve session list" + exit 1 + fi # exclude the desktop session, which is always the first declare -i counter=0 + IMPORTED_IDS="" echo "${SESSION_LIST}" | while read line do if [[ ${counter} -gt 0 ]] @@ -57,7 +64,17 @@ session=$(echo ${line} | cut -d"'" -f 2) description=$(echo ${line} | cut -d"'" -f 4) echo "Session: '${session}' -> Description '${description}'" + + # import or update db entry + mysqldo "insert into values_storefront_session (session,description,enabled) values('${session}','${description}','1') on duplicate key update session='${session}',description='${description}',enabled='1';" + + # get and save id + id=$(mysqldo "select id from values_storefront_session where session='${session}';") + IMPORTED_IDS+=" ${id}" fi (( counter++ )) done + + # now disable all other ids in the database + fi