Skip to content

Ayobrown/log-backup-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Log Backup Script

A simple bash script to archive system logs periodically using cronjobs and passwordless sudo for tar.

Features

  • Backs up /var/log/*.log files
  • Archives backups to ~/log-backups
  • Automates using a cronjob
  • Uses passwordless sudo for smooth automation

Setup

  1. Configure passwordless sudo for /bin/tar
  2. Set up a cron job to run the script every minute or change to your preferred time

Important Note: Why Use /bin/tar Directly

In the backup script, sudo /bin/tar is used instead of simply sudo tar.

This is intentional:

  • Using /bin/tar ensures that the script calls the exact trusted system binary located at /bin/tar.
  • It avoids any security risks where another tar binary (possibly malicious) could be found elsewhere in the system's PATH.
  • This ensures the backup is performed securely and reliably.

About

A bash script to automate backup of system log files with passwordless sudo configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages