Change MySQL backup script to use on PostgreSQL
have a look at pg_dump it's very similar to the dump utility by MySQL
See: pg_dump documentation 

I think most of the change is just changing the flags to match the new utility and replacing the call for mysql with a similar call to psql -l to get the db list (to filter out dbs you want to ignore)