Ping.sh: Upgrade bash script

Upgrade bash script due to changes in the structure of the database.