Shell Script to compare values from 2 db and update records accordingly

Job ID: 30944358

Budget: $30 – $250 USD

Sample of 2 db

remote.trunks_trunk

bal2_date
| bal2
| bal3_date
| bal3
| bal1_date
| bal1
| transfer_pin
| remain
| auto_pause_remain
| max_call
| max_call_inter
| auto_pause_attempt
| max_volume |
| max_volume_inter
| auto_pause_volume
| max_short_call
| max_short_call_length
| max_short_call_pause

local.auto_pause_setting

| id
| user_id
| ip
| db_name
| provider_id
| provider_name
| bal1_under
| bal2_under
| bal3_under
| balance_under
| bal_date_min
| asr1_under
| acd1_under
| goip_disconnect
| rest
| sleep_hours
| remain
| add_timestamp
| last_run_timestamp

remote and local link to each other by remote.name=local.provider_name


get list of ips to work with
select ip from user_ips group by ip

if ip start with 10.10 or 10.11 - merge these

check which ips are online , eg use ping

for ips which are online

update trunks_trunk set auto_pause = 1 where local.bal1_under is less remote.bal1 and remote.bal1_date is less than 20 min old

there are about 30 of such similar queries

I need for all ips to be updated simultanously and logs to be written as I will be calling via Cron

I have a sample script.
Related categories: Perl Python Linux MySQL Bash Scripting