Skip to content

Instantly share code, notes, and snippets.

@schtobia
Last active November 12, 2016 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schtobia/39896d11a13d16ec79f7f172230692f3 to your computer and use it in GitHub Desktop.
Save schtobia/39896d11a13d16ec79f7f172230692f3 to your computer and use it in GitHub Desktop.
Find and tar all changed config files in /etc. Kudos to blast_hardcheese https://serverfault.com/a/658796
#! /bin/bash
[ -z "$1" ] && { (>&2 echo "Usage: $0 <backup.tar>"); exit 1; }
touch "$1" || { (>&2 echo "Cannot write to $1"); exit 1; }
find /etc -type f | grep -vFf <(debsums -e 2>/dev/null | sed 's/[[:space:]]*OK$//') | xargs tar cf "$1" 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment