Subversion Repositories SmartDukaan

Rev

Rev 7667 | Rev 8858 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7667 Rev 8857
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
mysql -u root -pshop2020 -h 192.168.190.113 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
2
mysql -u root -pshop2020 -h 192.168.190.113 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
3
sleep 2
3
sleep 2
4
cp /tmp/popularity.json /tmp/popularity_bk.json
4
cp /tmp/popularity.json /tmp/popularity_bk.json
5
sleep 2
5
sleep 2
6
sed -i '1d' /tmp/popularity.json
6
sed -i '1d' /tmp/popularity.json
7
sleep 2
7
sleep 2