Skip to content

Instantly share code, notes, and snippets.

@rtitle
Last active April 13, 2017 14:29
Show Gist options
  • Save rtitle/52b9bba742353a8060516c59fb4ad247 to your computer and use it in GitHub Desktop.
Save rtitle/52b9bba742353a8060516c59fb4ad247 to your computer and use it in GitHub Desktop.
Handling Fees

Get all AODs without a handling fee:

# on CIC DB:

$ cat aods.sql
copy (
select distinct ip.uid from core.inventory_pools ip, core.inventory_pools_inventory_sources ipis, core.inventory_sources iss
where ip.id = ipis.inventory_pool_id and ipis.inventory_source_id = iss.id and iss.type = 'DealInventory' and lower(iss.name) like 'always on%'
except
select distinct ip.uid from core.inventory_pools ip, core.rate_instances_domains rid, core.rate_instances ri 
where ip.id = rid.data_domain_id and rid.data_domain_type = 'InventoryPool' and rid.rate_instance_id = ri.id
) to stdout;

$ psql -f aods.sql -d dxmc_production > aods.txt

Insert HFs for AODs:

# on cic-app:
$ cat aods_2017.sh
#!/bin/bash

for d in `cat aods.txt` ; do

echo "/opt/dxcic/bin/handling_fee.sh --percent -ip $d -p 2rbLmj -start yyyy-mm-ddT00:00:00 -v 17 -f" 
/opt/dxcic/bin/handling_fee.sh --percent -ip $d -p 2rbLmj -start yyyy-mm-ddT00:00:00 -v 17 -f

done

$ nohup ./aods.sh > aods.out 2>&1 &

Insert HFs for an Organization:

# on cic-app:
$ cat ford_hfs.sh 
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADAPTV -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADCONDUCTOR -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADEASY -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADMAX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADMETA -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADSCALE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ADSKOM -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e AERSERVE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e AOL -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e APPNEXUS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e AXONIX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e BEACHFRONT -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e BETWEEN -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e BRIGHTROLL -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e BRX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e CASALE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e CENTRO -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e CONTEXTWEB -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e DISH -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e FACEBOOK_RTB -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e FALKTECH -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e FMX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e GENIEE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e GOOGLE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e GOOGLE_CONTENTNETWORK -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e GUMGUM -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e GUMGUM2 -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e IBILLBOARD -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e IMPROVE_DIGITAL -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e INNERACTIVE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e KARGO -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e KIOSKED -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e KRUX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e LIVEINTENT -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e LIVERAIL -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e LKQD -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e MADS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e MEDIABONG -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e MOBFOX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e MOPUB -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e NASMEDIA -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e NETSPRINT -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e NEXAGE_RTB -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e OPENX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e OPERA -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e OPTIMATIC -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e PRIVATE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e PUBMATIC -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e REPUBLER -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e RHYTHM_ONE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e RUBICON -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SCALEOUT -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SMAATO -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SMARTADSERVER -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SONOBI -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SPOTX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e STICKYADS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e SWITCHCONCEPTS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e TEADS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e THIRDPRESENCE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e TREMOR -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e UNRULYX -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e VDOPIA -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e WHERE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e WORDPRESS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e XROST -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e YAHOO -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e YIELDLAB -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e YIELDONE -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e YIELDONE_INNITY -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e YIELDPARTNERS -start 2016-12-03T00:00:00
/opt/dxcic/bin/handling_fee.sh -v 17 -percent -o 9208 -e ZEDO -start 2016-12-03T00:00:00

$ nohup ./ford_hfs.sh > ford_hfs.out 2>&1 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment