Skip to content

Aly-Habib/automated-backup-using-bash-and-cron-job

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

backup.sh – Daily Secure Backup Script

Daily automated backup script using bash script and cron job. backup.sh automatically archives files modified in the last 24 hours and drops the compressed backup in a safe destination folder.

Features

  • Pure Bash (no external libs)
  • Time-stamped archive name: backup-<UNIX_TS>.tar.gz
  • Works with any source/destination paths
  • Designed for daily execution via cron

Usage

chmod +x backup.sh ./backup.sh <source_dir> <destination_dir> # example ./backup.sh /etc/secure /var/backups

Quick start

git clone https://github.com/Aly-Habib/automated-backup-using-bash-and-cron-job.git cd automated-backup-using-bash-and-cron-job

Schedule with cron

Run the following command to open cron job file to edit

crontab -e

Then, add the following line and save the file.

0 12 * * * /path/to/backup.sh # daily at 12:00

About

Daily automated backup script using bash script and cron job.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages