This shell script should work:
zammad run rails runner 'if Sessions.sessions.size > 0; delay = 5; Sessions.broadcast({event:"maintenance", data: {type: "message", head: "System Update", message: "The ticket system will be updated in #{delay} minutes (#{delay.minutes.from_now.to_s}). The update will take approximatly 5 minutes. You will be automatically logged out.", reload: false}}, "public"); sleep delay.minutes; end; Setting.set("maintenance_mode", true); Sessions.broadcast({event:"maintenance", data: {type: "mode", on: true}}, "public")'
# do your update
zammad run rails runner 'Setting.set("maintenance_mode", false);Sessions.broadcast({event:"maintenance", data: {type: "mode", on: false}}, "public")'
The first zammad run rails runner
command will warn active sessions 5 minutes in advance, will wait these 5 minutes and then activate the maintenance mode and log out all users.
The second zammad run rails runner
will disable the maintenance mode and broadcast the new setting to all connected clients.