Fix log directory not sometimes initialized

Sometimes nginx could have started before log files were initialized,
because log files were created in a background job. This should fix the
issue.