Honestly, I don't see the point in improving the script when there are better alternatives. I use daemontools's supervise. My run scripts look similar to this:
#!/bin/sh
cd /eathena/server/trunk
exec /eathena/server/trunk/char-server_sql > /dev/null
This way, if the server crashes it automatically restarts.