I don’t think your first snippet is doing what you’ve intended. The third argument to wp_schedule_event is a hook name, which in your case is wp_automatic_updater. This means that as soon as this event is fired, it will run:
do_action( 'wp_automatic_updater' );
From a quick look at the WordPress codebase, I don’t see anything scheduled for that event, so it will probably not do anything, unless you explicitly added something to that action. Or perhaps you were looking for the wp_maybe_auto_update event instead?
Your second approach is also quite risky. By default, WordPress checks for core, plugin and theme updates twice a day using a cron job (see wp_schedule_update_checks). This means that your update will succeed only if that cron job explicitly falls within that one hour interval. However, with the job scheduled to twicedaily, your job can be scheduled for:
- 00:00 and 12:00
- 01:00 and 13:00
- 02:00 and 14:00
- 03:00 and 15:00 (only this will work for you)
- 04:00 and 16:00
- 05:00 and 17:00
- etc.
And everything in between of course. So there is a high chance that the 03:00-04:00 time slot may not be hit at all, in fact multiple days or even weeks in a row. Luckily, when it comes to WordPress cron and the nature of its recurring tasks, there’s usually a slight drift, so eventually the schedule will still drift into the 3-4 slot and remain there for a few rounds, but that is really not a reliable way to do updates.
As far as picking between the two, I’d say your first approach is a bit closer. However, I would create an explicit non-recurring task at “tomorrow 3 am”, and have the task handler re-schedule itself for “tomorrow 3 am”, and then perform any updates if necessary. This way there will never be a continuous drift like with a recurring schedule, and you’ll be “guaranteed” your task runs at around 3 am every day. You can add a further check in the handler to skip updates if it’s outside of your maintenance window, just in case the task execution is too late or too early for any reason. You will also need to suppress/disable the original twicedaily core auto-updates.
Hope this helps.