These commands will shut down your server (die), rehash your server (clearing temporary server bans and similar), or shut down and then restart the server,
/as util server rehash
You will probably not want to write a script that will shut down your server. Once shut down, there may not be someone with sufficient access to bring it back up. But if you had a reason to, you could set up a script to shut down your server and then connect it to an event that you could configure to execute at a specific time. This way if you wanted to shut down your server at some particular time, you would not have to even be online to do it. Regular rehashing is a more practical and common use for scripts and events. Restarting might also be desired.