Subversion Repositories SmartDukaan

Rev

Rev 8858 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7094 amit.gupta 1
#!/bin/bash
20404 amit.gupta 2
mysql -u root -pshop2020 -h 192.168.190.114 user -e "SET SESSION group_concat_max_len = 100000;select CONCAT('{',GROUP_CONCAT('\"',a.itemId,'\":',a.c),'}') from (select itemId, floor(count(*)/greatest(1,datediff(now(), min(addedOn)))*100) 'c' from userwidgetitem where addedOn > DATE_SUB(now(),INTERVAL 30 DAY) group by itemId) as a;" > /tmp/popularity.json
7094 amit.gupta 3
sleep 2
4
cp /tmp/popularity.json /tmp/popularity_bk.json
5
sleep 2
6
sed -i '1d' /tmp/popularity.json
7
sleep 2
20404 amit.gupta 8
mysql -u root -pshop2020 -h 192.168.190.114 catalog -e "SET SESSION group_concat_max_len = 100000;select CONCAT('[', GROUP_CONCAT(id),']') from item where status=6;" > /tmp/availability.json
7665 amit.gupta 9
sleep 2
10
cp /tmp/availability.json /tmp/availability_bk.json
11
sleep 2
12
sed -i '1d' /tmp/availability.json
13
sleep 2
14
scp /tmp/popularity.json /tmp/availability.json root@staging:/var/lib/tomcat6/webapps/export/