Rev 7667 | Rev 8858 | 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 2mysql -u root -pshop2020 -h 192.168.190.113 catalog -e "SET SESSION group_concat_max_len = 100000;select CONCAT('[', GROUP_CONCAT(id),']') from item where status=6;" > /tmp/availability.jsonsleep 2cp /tmp/availability.json /tmp/availability_bk.jsonsleep 2sed -i '1d' /tmp/availability.jsonsleep 2scp /tmp/popularity.json /tmp/availability.json root@staging:/var/lib/tomcat6/webapps/export/