Fixes rhq-agent.sh to work properly and returns the functionality of PR #149

This should return the functionality provided in the PR #149, but also ensure that the console access to the rhq-agent still works.

Note: this does not fix the rhqctl console command, it still behaves incorrectly.