fixing init script. adding envvar support

Pulled in some stuff from the official ES init script to to stop/start.

Also added support for setting envvars (hijacked what I thought was the original param for doing it)