command line – Temporarily halt logins while launchd is running a timed script

I have a launchd triggered timed script that checks if a user is not logged in and runs a one-time folder clean-up operation when they’re not.

The script is fast, but I still don’t want the user trying to log in while it’s running.

How to prevent that?

  • is there a way to delay/prevent a login?
  • can a shell script block other processes (extreme renice or something)?
  • or a login launchd thing that imposes a reasonable delay before proceeding?

Ideally, there would be some less hackish way; I’m not too familiar with this. Any ideas appreciated.