It depends on which SharePoint version you have. Basically, backup and restore is done from the command prompt so it is easy to automate the process. You can do a google search for the specific commands. For example, here are two blog posts I found that explain how to backup a SPS 2003 and a MOSS 2007 site respectively: