Your change_channel script does seem a bit complicated plus it doesn't have a sleep. Just use the one in /usr/share/doc/mythtv-backend/contrib/channel_changers/change-channel-lirc and adjust the sleep to fit your system.