Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have made two shell scripts

Script 1: It does all Home directory backups with name

 username_home_date.tar.gz

Script 2: It does SQL backups of all sites every 3 hrs.

username_databse_date.sql.gz

Now currently if I want to restore the site, I have to copy the tar file to

/home/username

and then untar there with all the permissions as well and then manually import the database.

Is there any way (for instance a program, system or script) that I can just select which backup I want to restore and do automatically?

Maybe like a cPanel addon thing.

share|improve this question
1  
Hey Mirage, hope you don't take offense to me editing your posts this evening. I'm just lookin' out for you. Trying to make things a little clearer, clean up spelling and punctuation and make it more likely that people will pay attention to your post. –  Wesley Mar 9 '10 at 2:34
    
sorry for that , i will take care in future. Actually i was in the hurry to post questions :) –  John Mar 9 '10 at 4:41

2 Answers 2

up vote 1 down vote accepted

The script you write, which could be as simple as:

zcat username_database_date.sql.gz | mysql

Depending upon how you dumped the database(s), you might have to drop before sourcing the file. Be careful.

share|improve this answer
    
IS it possible to to make a webpage for that so that it shows all backups in dropdown list and i click restore. But all restore is done at background by shell.Is this possible –  John Mar 9 '10 at 4:43
    
It is technically possible, yes. I cannot recommend a pre-existing solution for cpanel. –  Warner Mar 9 '10 at 5:28
    
It doesn't necessarily be a capnel. If that possbile i can make a php page on main domain name and from there i can restrore backups. Can i use shell commands inside php language –  John Mar 9 '10 at 5:43
    
You can make system calls from PHP using the system() function. Be aware though that a web page will be run as apache so may not and should not have permissions do do what you require. Alternatively you could get a PHP script to set a trigger such as add the job to a MySQL table, that a user with permissions to run the job can check from a cron script if there are any jobs in the table and process them. Just take you time and think about the security implications as you do this. –  Richard Holloway Mar 9 '10 at 14:28

If you are willing to let go of your script-based backup system, take a look at BackupPC. It can easily restore files. Databases have to be restored some other way though.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.