You might want to take a look at my back-up/restore and clean-up script in the How-to section of this forum. It is at version 1.4a and works very well for me.
It has a number of features and tries to be flexible to meet lots of different needs.
Insanity: Doing the same thing over and over and each time expecting a different result.
Democracy is 2 wolves and a lamb voting on the menu. Liberty is an armed lamb protesting the electoral outcome. A Republic negates the need for an armed protest.