Reputation: 9202
I have a Java Spring MVC web Application. And it has some configuration and properties files.
There is a directory, let's say, myappconf. Inside that there are configuration and property folders. Inside that some files are there.
myappconf
|
|---conf
| |
| |__ settings.xml
| |__ nodes.xml
|
|---prop
|
|__ app.properties
I want to take backup of the entire folder into another location. I already have Quartz implemented to run some other Jobs. I can use the same for taking backups also. To a specified location I can copy the entire folder on a specific interval or when any file is changed.
I am running the application in tomcat.
In case, the application is crashed, or the server is failed, I want to install a new application in the server and it should restore the configuration. The folder will have some data also. I want to restore all.
I am not aware of how to restore it. Has anybody implemented something like this? or anybody has some Guidelines for Backup and restore?
Thanks
Upvotes: 3
Views: 4203
Reputation: 8767
I would do it in this manner -
startup.sh
file which is executed when tomcat is started.This will continue recursively until you manually remove the entry created in step-1.
Hope this helps.
Upvotes: 2
Reputation: 1894
Yup, you can simply copy the files in your "exploded war" directory. You can use quartz if you wish, or you can use any file system backup tool. The later may be easier, because it has restore capabilities.
In the event that you do go with your own tooling (ie quartz), to "restore" you would shutdown your tomcat instance, copy the files back into place, optionally overwriting the old ones, and turn tomcat back on. Tomcat reads from the exploded war files, so you'll be good to go.
Edit: ideally, you would want to shutdown tomcat (gracefully) before copying off your files, to ensure that if any changes for those files that were in memory were flushed -- but, in practice, this is rarely an issue with these kinds of files (my opinion).
Upvotes: 1