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/citrix-enumerate.conf |
7 |
source @@SYSCONFDIR@@/mcore/control.conf |
source @@SYSCONFDIR@@/mcore/control.conf |
8 |
source ${MCORE_LIBDIR}/include/common.global.class |
source ${MCORE_LIBDIR}/include/common.global.class |
9 |
source ${MCORE_LIBDIR}/include/daemon.global.class |
source ${MCORE_LIBDIR}/include/daemon.global.class |
16 |
|
|
17 |
export IMPORTED_IDS="" |
export IMPORTED_IDS="" |
18 |
|
|
19 |
|
LOCKFILE="@@RUNDIR@@/lock/storefront-cron.lock" |
20 |
|
|
21 |
is_not_an_import_id() |
is_not_an_import_id() |
22 |
{ |
{ |
23 |
local id="$1" |
local id="$1" |
34 |
return 0 |
return 0 |
35 |
} |
} |
36 |
|
|
37 |
# get default store |
# the lockfile is not meant to be perfect, it's just in case the |
38 |
if [[ -z ${STOREFRONT_STORE} ]] |
# two cron scripts get run close to each other to keep |
39 |
then |
# them from stepping on each other's toes. |
40 |
export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}" |
[[ -f ${LOCKFILE} ]] && exit 0 |
41 |
fi |
|
42 |
|
trap "{ rm -f ${LOCKFILE}; exit 0; }" EXIT |
43 |
|
touch ${LOCKFILE} |
44 |
|
|
45 |
|
# get default settings from configs |
46 |
|
[[ -z ${STOREFRONT_STORE} ]] && export STOREFRONT_STORE="${DEFAULT_STOREFRONT_STORE}" |
47 |
|
[[ -z ${STOREFRONT_USER} ]] && export STOREFRONT_USER="${MCORE_STOREFRONT_USER}" |
48 |
|
[[ -z ${STOREFRONT_PASS} ]] && export STOREFRONT_PASS="${MCORE_STOREFRONT_PASS}" |
49 |
|
[[ -z ${STOREFRONT_DOMAIN} ]] && export STOREFRONT_DOMAIN="${MCORE_STOREFRONT_DOMAIN}" |
50 |
|
|
51 |
if ! storebrowse &> /dev/null |
if ! storebrowse &> /dev/null |
52 |
then |
then |
91 |
then |
then |
92 |
session=$(echo ${line} | cut -d"'" -f 2) |
session=$(echo ${line} | cut -d"'" -f 2) |
93 |
description=$(echo ${line} | cut -d"'" -f 4) |
description=$(echo ${line} | cut -d"'" -f 4) |
94 |
echo "Session: '${session}' -> Description '${description}'" |
decho "Session: '${session}' -> Description '${description}'" |
95 |
|
|
96 |
# import or update db entry |
# import or update db entry |
97 |
id=$(mysqldo "select id from values_storefront_session where session='${session}';") |
id=$(mysqldo "select id from values_storefront_session where session='${session}';") |
98 |
if [[ -z ${id} ]] |
if [[ -z ${id} ]] |
99 |
then |
then |
100 |
mysqldo "insert into values_storefront_session (session,description,enabled) values('${session}','${description}','1');" |
mysqldo "insert into values_storefront_session (session,description,store,enabled) values('${session}','${description}','${STOREFRONT_STORE}','1');" |
101 |
else |
else |
102 |
mysqldo "update values_storefront_session set session='${session}',description='${description}',enabled='1' where id='${id}';" |
mysqldo "update values_storefront_session set session='${session}',description='${description}',store='${STOREFRONT_STORE}',enabled='1' where id='${id}';" |
103 |
fi |
fi |
104 |
|
|
105 |
# get and save id |
# get and save id |
122 |
fi |
fi |
123 |
done |
done |
124 |
fi |
fi |
125 |
|
|
126 |
|
exit 0 |