With server commands you can probably do this. But the main problem is normally to shut down the pi and then disable the power supply. Otherwise you risk damage on sd filesystem.
You can define a function in your printer config that gets called at job end and tests if condition is met for a "special" action. Call this in response to jobDeactivated event. With
@sendToPrinter slug command
Sends command to the printer with given slug name. That way you can execute command sin the context of another printer. Note that command and all command parameter get parsed first in your printer context, so outer quotes get removed and computed expressions get executed. Escape them if that is not wanted accordingly.
you can execute commands in other printers. Idea would be to set a counter in server global to 0 and let each printer add 1 to it if job is running.
@func testShutdown
@if {{sglobal.jobCount > 0}}
...
@endif
@endfunc
@set sglobal.jobCount 0
@sendToPrinter p1 set sglobal.jobCount {{sglobal.jobCount + job.running}}
@sendToPrinter p2 set sglobal.jobCount {{sglobal.jobCount + job.running}}
@sendToPrinter p3 set sglobal.jobCount {{sglobal.jobCount + job.running}}
@timedCall shutTimer 60000 testShutdown
p1-p3 are the slug names of your printers here. You need a delay since you do not know when the command on other printer gets executed. Most risky time is when communication is blocked during heatup of bed/extruder so you might need to increase delay.
But as said you should shutdown and then disable relay so it should bette rbe triggered by a external service or with some delay if that is possible.