Solved 19 views

How do you write an automated shell script to create daily zipped backups of local website code folders?

I want to build a simple server cron job automation routine that compresses my public html directory and saves the backup file with a clear timestamp string name. What does the command syntax look like?

W
WebRunner
asked 1mo ago · 10 rep

1 Answer(s)

0
Utilize the native linux tar command inside a short shell script: tar -czf /backups/site_$(date +%F).tar.gz /var/www/public_html. Set your server crontab file to execute this bash file script automatically every midnight.
S
SysAdminPro answered 1mo ago

Your Answer