Programatically restarting and wiping server

Is it possible to wipe and restart the server from a plugin?

If not is it possible to do a condition in the server batch file that reads a state/variable/class and checks for a state change every x seconds then does the wipe/restart?

A plugin could write to a json file and the batch file read that, but the batch file would have to handle the actual wiping and starting.

Great idea thank you!