Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2516 by niro, Mon Sep 14 10:51:04 2015 UTC revision 2519 by niro, Mon Sep 14 12:12:48 2015 UTC
# Line 3  Line 3 
3  MCORE_LIBDIR="@@MCORE_LIBDIR@@"  MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4  source @@SYSCONFDIR@@/mcore/mcore.conf  source @@SYSCONFDIR@@/mcore/mcore.conf
5  source @@SYSCONFDIR@@/mcore/citrix.conf  source @@SYSCONFDIR@@/mcore/citrix.conf
6    source @@SYSCONFDIR@@/mcore/control.conf
7  source ${MCORE_LIBDIR}/include/common.global.class  source ${MCORE_LIBDIR}/include/common.global.class
8  source ${MCORE_LIBDIR}/include/daemon.global.class  source ${MCORE_LIBDIR}/include/daemon.global.class
9  source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class  source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class
# Line 18  then Line 19  then
19   export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}"   export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}"
20  fi  fi
21    
22  if ! storebrowse > /dev/null  if ! storebrowse &> /dev/null
23  then  then
24   if [ -d ~/.ICAClient ]   if [ -d ~/.ICAClient ]
25   then   then
# Line 29  then Line 30  then
30   touch ~/.ICAClient/.eula_accepted   touch ~/.ICAClient/.eula_accepted
31    
32   # kill running instances   # kill running instances
33   pidof AuthServiceDaemon > /dev/null && killall AuthServiceDaemon   pidof AuthManagerDaemon > /dev/null && killall AuthManagerDaemon
34   pidof ServiceRecord > /dev/null && killall ServiceRecord   pidof ServiceRecord > /dev/null && killall ServiceRecord
35   pidof storebrowse > /dev/null && killall storebrowse   pidof storebrowse > /dev/null && killall storebrowse
36    
# Line 43  then Line 44  then
44   echo "Store ${STOREFRONT_STORE} unknown, perhaps not added. Run 'rm -r ~/.ICAClient'."   echo "Store ${STOREFRONT_STORE} unknown, perhaps not added. Run 'rm -r ~/.ICAClient'."
45  else  else
46   OPT=""   OPT=""
47   [[ -n ${STOREFRONT_USER} ]] && OPT+=" -U \"${STOREFRONT_USER}\""   [[ -n ${STOREFRONT_USER} ]] && OPT+=" -U ${STOREFRONT_USER}"
48   [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P \"${STOREFRONT_PASS}\""   [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P ${STOREFRONT_PASS}"
49   [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D \"${STOREFRONT_DOMAIN}\""   [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D ${STOREFRONT_DOMAIN}"
50   SESSION_LIST="$(storebrowse -E ${OPT} ${STOREFRONT_STORE})"   SESSION_LIST=$(storebrowse -E ${OPT} ${STOREFRONT_STORE})
51   echo "${SESSION_LIST}"   if [[ $? != 0 ]]
52     then
53     echo "could not retrieve session list"
54     exit 1
55     fi
56    
57     # exclude the desktop session, which is always the first
58     declare -i counter=0
59     IMPORTED_IDS=""
60     echo "${SESSION_LIST}" | while read line
61     do
62     if [[ ${counter} -gt 0 ]]
63     then
64     session=$(echo ${line} | cut -d"'" -f 2)
65     description=$(echo ${line} | cut -d"'" -f 4)
66     echo "Session: '${session}' -> Description '${description}'"
67    
68     # import or update db entry
69     mysqldo "insert into values_storefront_session (session,description,enabled) values('${session}','${description}','1') on duplicate key update session='${session}',description='${description}',enabled='1';"
70    
71     # get and save id
72     id=$(mysqldo "select id from values_storefront_session where session='${session}';")
73     IMPORTED_IDS+=" ${id}"
74     fi
75     (( counter++ ))
76     done
77    
78     # now disable all other ids in the database
79    
80  fi  fi

Legend:
Removed from v.2516  
changed lines
  Added in v.2519