replace init.d with upstart scripts

This patch replaces init.d with upstart.

It probably needs review.