run as daemon functionality