Check before reboot

Hi there!

I have any of RBs without internet connections, so I had my drag and drop files to update the RB. Now I need only reboot them and that’s it.
Tired to do it manually, I centralized every RB updating and everything is working fine.
In my case, I have a script (and then scheduled) something similiar

System upgrade refresh
System upgrade download-all
System reboot

Delayed few seconds each process…

Question is simple, how can I reboot only if a newer version was found and downloaded, and not in any case?

Thx guys

ok found it!

fixed modified last action:
system upgrade download-all reboot-after-download=yes

thx anyway