Fix sed syntax, add more service management functions