Automatic Minecraft Server Updates

OK, I have a very simple question, but am not seeing any straighforward way to do this. I really want my minecraft server to just update to the latest stable version server jar every night if a new one is available. Can this be done with tasks or do I need to just automate instance restarts via the CLI? Thanks!