added function to shutdown mackarel server
write pid to file