Implemented robust data backup solutions by automating daily backups of the /home directory using Bash scripting and Cron jobs,

Ashique AntonyAshique Antony
1 min read

Automating daily backups of your /home directory in Linux. We'll compress it, log every move, and make it run every single night

This is a simple project to understand about creating log file and doing automate job using cronie

What we will do in this project is :

*Compresses /home directory
**Logs the backup details
*Keeps only the last 7 backups
**Runs daily at midnight via crontab

1, create a bash script at :

sudo nano /usr/local/bin/home_backup.sh

2,and write the bash script for it

3, Make it executable

sudo chmod +x /usr/local/bin/home_backup.sh

x = 1 = executable

4, We’ll use crontab to run this daily at 12:00 AM. Use this:"

crontab -e “in the same folder”

5, past this in the folder

0 0 * * * */*usr/local/bin/home_backup.sh

which in crone tab its in format

FieldValueMeaning
Minute0At minute 0
Hour0At 12:00 AM (midnight)
Day of month*Every day of the month
Month*Every month
Day of week*Every day of the week
0
Subscribe to my newsletter

Read articles from Ashique Antony directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ashique Antony
Ashique Antony

Passionate DevOps Engineer eager to drive innovation by automating workflows, optimizing cloud infrastructure, and enhancing CI/CD pipelines. Seeking an opportunity to collaborate with forward-thinking teams to streamline development and deployment processes for maximum efficiency and scalability.scalability.