How to fix corrupt packet error for with rsync for large files

In order to have local copies of my web pages hosted on VPS I have configured rsync cronjob to sync everything during the night to my local box.

Sometimes with larger files you can encounter errors like these:

Received disconnect from [YOUR_IP]: 2: Packet corrupt
rsync: [sender] write error: Broken pipe (32)
rsync error: unexplained error (code 255) at io.c(820) [sender=3.1.1]

Continue reading “How to fix corrupt packet error for with rsync for large files”

How to delete files older than certain number of days

One thing that comes very handy is usage of cron to make scheduled job to delete old files so that you can free up some space on your hard drive

# Delete Apache logs older than 60 days
find /var/log/apache2/ -mtime +60 -exec rm {} \;

With this simple script you will search through Apache logs in folder /var/log/apache2, select the ones with access time older than +60 (60 days) and execute delete with rm command.