Useful SSH Scripts

I’ve just created/updated some useful Shell scripts on my UK server. One performs a mysqldump backup of a database and emails a compressed copy at regular intervals. The second script rotates transfer and error logs each month.


For the database backup email you will need to install a copy of the email client “mutt”. Just run: yum install mutt to get this added.

You can use CRON to run all these tasks at regular intervals.

I recommend running the transfer-log backup on the first day of the month. The error log two weeks into the month. The SQL backup once a week. You may need to edit the date calculations (<days> * 86400) in the log rotation scripts.
To use the shrink scripts add Jul 2010 after the script name and for the database dump to email script add the email address after the script name.

Leave a Reply

Your email address will not be published. Required fields are marked *