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 2511 by niro, Mon Sep 14 09:55:43 2015 UTC revision 2521 by niro, Mon Sep 14 12:15:12 2015 UTC
# Line 2  Line 2 
2    
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
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
10    
11  if [ ! -d ~/.ICAClient ]  : ${STOREFRONT_STORE=""}
12  then  : ${STOREFRONT_USER=""}
13   install -d ~/.ICAClient  : ${STOREFRONT_PASS=""}
14  fi  : ${STOREFRONT_DOMAIN=""}
15    
16  if [ ! -f ~/.ICAClient ]  # get default store
17    if [[ -z ${STOREFRONT_STORE} ]]
18  then  then
19   touch ~/.ICAClient/.eula_accepted   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/.tmp ]   if [ -d ~/.ICAClient ]
25   then   then
26   rm -r ~/ICAClient/.tmp   rm -r ~/.ICAClient
27   fi   fi
28    
29     install -d ~/.ICAClient
30     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    
37   # register eula   # register eula and add default store
38   xvfb-run -a -s "-extension RANDR" storebrowse   xvfb-run -a -s "-extension RANDR" storebrowse -a "${STOREFRONT_STORE}"
39  fi  fi
40    
41  # get all sessions of default store  # get all sessions
42  export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}"  if [[ -z $(storebrowse -l | grep -i ${STOREFRONT_STORE}) ]]
43  ${MCORE_LIBDIR}/storefront-resolver  then
44     echo "Store ${STOREFRONT_STORE} unknown, perhaps not added. Run 'rm -r ~/.ICAClient'."
45    else
46     OPT=""
47     [[ -n ${STOREFRONT_USER} ]] && OPT+=" -U ${STOREFRONT_USER}"
48     [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P ${STOREFRONT_PASS}"
49     [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D ${STOREFRONT_DOMAIN}"
50     SESSION_LIST=$(storebrowse -E ${OPT} ${STOREFRONT_STORE})
51     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

Legend:
Removed from v.2511  
changed lines
  Added in v.2521