I think it is better to use cron for this purpose. Why duplicate this functionality?