Skip to main content

Posts

Showing posts with the label cron backup email

How to take backup of important system configuration files and get it all sent to you in an email

The purpose of this article is to protect your important configuration and setting files that could change over time and you would want to retain a copy of these files for protection of your system. I recommend you specify the list of important files and get them sent to you once a week via email using the script and guideline below. First of all you have to configure a cron task that will run regularly once every week and although you can set up a user specific cron it is advised to set up a system based cron since the task you are carrying out is system wide. user@server:/$ cat /etc/cron.weekly/aweeklycron #!/bin/sh echo "`date` - Daily cron - Taking config file backup and sending via email." >> /var/log/mycron.log /etc/sysconfig/configbackup.sh & >> /var/log/mycron.log Now place the script in directory mentioned above in the cron task. Create the direcory if it doesn't already exist. sudo mkdir /etc/sysconfig The script below...