Portal Home > Knowledgebase > Articles Database > cPanel back-up script


cPanel back-up script




Posted by LP560, 09-01-2007, 07:03 AM
I have a shared account which I would like to back-up on a cron job. I know several people have tried to create these type of scripts but they dont seem to do the following: 1) Full cPanel back-up (files/mysql etc) 2) FTP the back-up to a remote server 3) Delete the back-up on the local server 4) Delete the old back-up on the remote server Does anyone know of a script that will do the above or several scripts I could use? Webhostgear have one but that only moves the back-up file between servers, it doesn't backup or delete. Thanks in advance.

Posted by david510, 09-01-2007, 09:14 AM
You can find such a script here. I dont remember the exact link of that thread. A search will get you one

Posted by foobic, 09-01-2007, 10:21 PM
There are so many different backup scripts because they're easy enough to write and different people have different requirements (and different levels of access). For what you want to do, 1 2 and 3 are all covered by CPanel's own full backup - just view source on the CPanel form you submit to create a full backup and use curl or similar to submit the same data automatically. But I wouldn't want this running from the account itself because it would mean storing the CPanel account password in plain text in the script. You might consider doing it from a secure remote machine though. 4 would be a one-line cron job on the remote machine.

Posted by LP560, 09-02-2007, 07:01 AM
Ok, I'm getting somewhere with this, just need someone to confirm the following: The cPanel backup is left on the local server in the main root directory. I dont want these to build up, so I will need a cron which finds .tar.gz files and are 2 days old then deletes them. Will the following cron work: Thanks

Posted by foobic, 09-02-2007, 09:08 AM
If you use the CPanel full backup to remote server option the file that's left in the user directory is a dummy - only 10 or 20 bytes. If you still want to delete these I'd suggest a more specific find command or you might find your clients get unhappy when your script deletes for example /home/username/public_html/our_wedding_pics.tar.gz

Posted by LP560, 09-02-2007, 12:07 PM
Excellent just what I needed, I wondered about it deleting .tar.gz's in other directory's. The reason why I wanted the above code is because it leaves the backup file in the root directory (810mb), it isn't a dummy file. I dont know why its doing that, still waiting for the confirmation email from the script.

Posted by LP560, 09-03-2007, 05:31 AM
Errors: Tried almost everything but dont seem to be able to rectify the above errors. I think this is why I have the full 830mb backup file left on the local server.

Posted by david510, 09-03-2007, 05:41 AM
Make sure higher ports (range 35000 to 60000) are opened on the server. If you are using apf, most probably they might be blocked.

Posted by foobic, 09-03-2007, 06:04 AM
Looks like it's making the connection so it can't be blocked completely. What's the server at the other end? Can you upload a similar sized file manually? scp method might work better if you have that option.

Posted by david510, 09-03-2007, 06:36 AM
I have come across a similar issue and enabling the higher ports sorted it . It makes connection, but no data is transferred.

Posted by foobic, 09-03-2007, 07:17 AM
Wouldn't that be in active mode, where the ftp server makes a data connection back to a high numbered local port? This is using passive mode. Could still be the firewall though - check the outbound filtering rules.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
How to secure my site (Views: 696)
ahvio.com! (Views: 789)


Language: