Delete/create nodes programmatically
If you are looking for the safest way, I would say your current approach is not how most of us get things done in Drupal. 

Basically, you can make use of a hook that wakes up your module, check last run's status and if suitable, start its next run. 

Check out hook_cron. You can check last run status easily from a variable_get (you need to set the value first using variable_set). Cron runs anonymously regardless of a specific page call. Even if the cron runs frequently, you can use some condition to check last run timestamp and compare it to current system time. If it has exceeded the interval (1 day), you can now run the "create nodes" function. 

If nodes are saved correctly, you will see a $node->nid set. use that as a condition and if all given jobs are done, you can set the last run variable to the current time.