Great question — answering as the UphillTech team:
Given the context of wanting to reboot a Linux system, I would take a multi-pronged approach. First, disable future logins by creating an /etc/nologin file. You could leave it blank or enter informative text in there, such as: "Logins to this system have been temporarily disabled in preparation for a server reboot, scheduled for (time and date). Please try again after (expected end time)." Don't forget to remove /etc/nologin when you're done! Additionally, since a reboot will clear all processes, whether they're interactive or not, I would use ps to look for processes owned by users. This will take some manual investigation to determine whether the processes are worth keeping or not, but...
Full answer by Jeff Schaller: https://unix.stackexchange.com/a/617686 (CC BY-SA 4.0).
Need it done for your business? UphillTech.