Rev 7667 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/bin/bashmysql -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.jsonsleep 2cp /tmp/popularity.json /tmp/popularity_bk.jsonsleep 2sed -i '1d' /tmp/popularity.jsonsleep 2scp /tmp/popularity.json root@staging:/var/lib/tomcat6/webapps/export/