I have use a Mac mini (running Ventura) with a connected Drobo as a file server. The file sharing is standard Mac file sharing to other Macs via SMB. I believe AFP is no longer supported, or no longer the default.

It is set to restart, using pmset, on a schedule.

If a client computer has mounted the file share, then the file share computer fails to shut down.

How can I, from the command line (and hence from a cron job), ensure that all connected clients are forcibly disconnected?

  • how do the clients mount, via smb? Can you shutdown via shutdown instead of pmset?
    – nohillside
    Commented Nov 13, 2023 at 11:47
  • @nohillside , the file server is Mac file sharing to other Macs via SMB. I believe AFP is no longer supported, or at least no longer the default.
    – Vihung
    Commented Nov 13, 2023 at 16:33

1 Answer 1


/sbin/shutdown will shut down your Mac even with users logged in/server connections still open. To make sure your server shuts down at the appropriate time, you can run /sbin/shutdown -t now via cron.

PS: There is of course a slight risk of data loss in case a client is currently updating data on the server. But this can't be avoided if you want to shutdown forcefully.

  • Thanks. I think this has to be my route if there's no way to explicitly disconnect clients. In my mind, a shutdown via pmset seems more graceful (I suppose, hence the problem with connected clients) while shutdown seems drastic - somewhat like pulling the plug!
    – Vihung
    Commented Nov 14, 2023 at 8:48
  • 1
    @Vihung Pulling the plug is worse. shutdown tries to end processes gracefully and ensures that pending writes get written to disk. But it can't ensure data consistence on application level (but then, no server-side approach can).
    – nohillside
    Commented Nov 14, 2023 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .