Annotation of /mcore-src/trunk/mcore-tools/src/modules/citrix/storefront-cron.in
Parent Directory | Revision Log
Revision 2518 -
(hide annotations)
(download)
Mon Sep 14 11:36:20 2015 UTC (8 years, 9 months ago) by niro
File size: 1758 byte(s)
Mon Sep 14 11:36:20 2015 UTC (8 years, 9 months ago) by niro
File size: 1758 byte(s)
-get the right session and description
1 | niro | 2511 | #!/bin/bash |
2 | |||
3 | MCORE_LIBDIR="@@MCORE_LIBDIR@@" | ||
4 | source @@SYSCONFDIR@@/mcore/mcore.conf | ||
5 | niro | 2514 | source @@SYSCONFDIR@@/mcore/citrix.conf |
6 | niro | 2511 | source ${MCORE_LIBDIR}/include/common.global.class |
7 | niro | 2515 | source ${MCORE_LIBDIR}/include/daemon.global.class |
8 | niro | 2514 | source ${MCORE_LIBDIR}/include/mysqlfunctions.global.class |
9 | niro | 2511 | |
10 | niro | 2514 | : ${STOREFRONT_STORE=""} |
11 | : ${STOREFRONT_USER=""} | ||
12 | : ${STOREFRONT_PASS=""} | ||
13 | : ${STOREFRONT_DOMAIN=""} | ||
14 | niro | 2511 | |
15 | niro | 2514 | # get default store |
16 | if [[ -z ${STOREFRONT_STORE} ]] | ||
17 | niro | 2511 | then |
18 | niro | 2514 | export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}" |
19 | niro | 2511 | fi |
20 | |||
21 | niro | 2517 | if ! storebrowse &> /dev/null |
22 | niro | 2511 | then |
23 | niro | 2514 | if [ -d ~/.ICAClient ] |
24 | niro | 2511 | then |
25 | niro | 2516 | rm -r ~/.ICAClient |
26 | niro | 2511 | fi |
27 | |||
28 | niro | 2514 | install -d ~/.ICAClient |
29 | touch ~/.ICAClient/.eula_accepted | ||
30 | |||
31 | niro | 2511 | # kill running instances |
32 | niro | 2517 | pidof AuthManagerDaemon > /dev/null && killall AuthManagerDaemon |
33 | niro | 2511 | pidof ServiceRecord > /dev/null && killall ServiceRecord |
34 | pidof storebrowse > /dev/null && killall storebrowse | ||
35 | |||
36 | niro | 2514 | # register eula and add default store |
37 | xvfb-run -a -s "-extension RANDR" storebrowse -a "${STOREFRONT_STORE}" | ||
38 | niro | 2511 | fi |
39 | |||
40 | niro | 2514 | # get all sessions |
41 | if [[ -z $(storebrowse -l | grep -i ${STOREFRONT_STORE}) ]] | ||
42 | then | ||
43 | echo "Store ${STOREFRONT_STORE} unknown, perhaps not added. Run 'rm -r ~/.ICAClient'." | ||
44 | else | ||
45 | OPT="" | ||
46 | niro | 2517 | [[ -n ${STOREFRONT_USER} ]] && OPT+=" -U ${STOREFRONT_USER}" |
47 | [[ -n ${STOREFRONT_PASS} ]] && OPT+=" -P ${STOREFRONT_PASS}" | ||
48 | [[ -n ${STOREFRONT_DOMAIN} ]] && OPT+=" -D ${STOREFRONT_DOMAIN}" | ||
49 | SESSION_LIST=$(storebrowse -E ${OPT} ${STOREFRONT_STORE}) | ||
50 | niro | 2518 | |
51 | # exclude the desktop session, which is always the first | ||
52 | declare -i counter=0 | ||
53 | echo "${SESSION_LIST}" | while read line | ||
54 | do | ||
55 | if [[ ${counter} -gt 0 ]] | ||
56 | then | ||
57 | session=$(echo ${line} | cut -d"'" -f 2) | ||
58 | description=$(echo ${line} | cut -d"'" -f 4) | ||
59 | echo "Session: '${session}' -> Description '${description}'" | ||
60 | fi | ||
61 | (( counter++ )) | ||
62 | done | ||
63 | niro | 2514 | fi |