When you use with wait with the hh:mm:ss option, the time you specify is not the maximum total time the server takes to shut itself down. Instead, the server takes into account the time it takes to perform the first checkpoint, and automatically subtracts this from the time you specified.
For example, if you specify a maximum wait time of 20 minutes and the first checkpoint takes 3 minutes, the server allows up to 17 minutes for the processes to finish. If for some reason the second checkpoint takes longer, however, this is not calculated into the with wait hh:mm:ss parameter you specify.
The server also accommodates a checkpoint that takes longer than the time you specify in with wait hh:mm:ss. For example, if you specify a wait time of 10 minutes but the first checkpoint takes 20 minutes to complete, the server does not interrupt checkpoint midway, but instead waits for checkpoint to complete. When this occurs, the server immediately begins to shut down after checkpoint is complete, since the time you specified has passed, and runs the last checkpoint with the flag informing you of the flushes you must perform.
Performs checkpoint on all the databases
Prevents any new user from logging in
Waits for all running or sleeping processes to finish their job
Performs another checkpoint on the databases, this time with a flag that informs you that you need to flush:
All the dynamic thresholds in mixed log-data databases
All the object statistics
The values of the identity fields to avoid holes after recovery