Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #23 from weslambert/master
Browse files Browse the repository at this point in the history
add cron jobs for backing up server/sensor config daily
  • Loading branch information
dougburks authored Oct 29, 2018
2 parents 8da9695 + fc30f4f commit 3cd8804
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions etc/cron.d/sensor-backup-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# /etc/cron.d/sensor-backup-config
#
# crontab entry to backup sensor config; purge backups older than 10 days
DAYSTOKEEP=10
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 1 * * * root if [ -d /etc/nsm/backup ]; then :; else mkdir /etc/nsm/backup; fi; for i in $(cat /etc/nsm/sensortab | grep -v '#' | awk '{print $1}'); do /usr/sbin/nsm_sensor_backup-config --force-yes --sensor-name=$i --backup-file=/etc/nsm/backup/$i-sensor-backup-`date +\%Y-\%m-\%d`.tar.gz >> /var/log/nsm/$i-backup-config.log 2>&1; done; /usr/bin/find /etc/nsm/backup/*sensor-backup*.tar.gz -mtime +$DAYSTOKEEP -exec rm -f {} \;

8 changes: 8 additions & 0 deletions etc/cron.d/server-backup-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# /etc/cron.d/server-backup-config
#
# crontab entry to backup server config; purge backups older than 10 days
DAYSTOKEEP=10
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 1 * * * root if [ -d /etc/nsm/backup ]; then :; else mkdir /etc/nsm/backup; fi; /usr/sbin/nsm_server_backup-config --force-yes --server-name=securityonion --backup-file=/etc/nsm/backup/securityonion-server-backup-`date +\%Y-\%m-\%d`.tar.gz >> /var/log/nsm/server-backup-config.log 2>&1; /usr/bin/find /etc/nsm/backup/*server-backup*.tar.gz -mtime +$DAYSTOKEEP -exec rm -f {} \;

0 comments on commit 3cd8804

Please sign in to comment.