add daemon function.