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

I'd like to schedule a cronjob on my server to backup the entire public_html directory daily. I am logged into cPanel and I am on the Cron Job page where I have it set to run this command everyday at 2am: tar -vcf /site_backup.tar /public_html/

Is this command sufficient for what I want to do? I want to store the contents of public_html in the site_backup.tar that resides in the root directory (one level up from public_html). Do I need to provide anything else in the command for it to run correctly?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

That command would serve its purpose but is there any reason you aren't using any compression like gzip or bzip? Also since this is in a cron I see no real reason to have the -v flag, no need to see the output.

Just add a -z to your command flags for gzip.

So your final command would be:

tar -zcf /site_backup.tar.gz /public_html/
share|improve this answer

tar cvfz site_backup.tar.gz /path/to/your/user/public_html/ should be enough here, however it's better if you backup this using the cpanel functionality and do it to a remote ftp server.

Additionally you can use something like www.backupsetc.com to backup you cpanel account, using it is pretty straight-forward(you just have to specify your server and accounts to be backed up).

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.