move pidfile function to daemon pkg