Last active
May 15, 2022 05:08
-
-
Save amigus/ae59a8b57de3b19949992a995b97f8de to your computer and use it in GitHub Desktop.
A script that creates a script that backs up the '/etc' folder. To use it, run `/etc/bak` after running the script below, as root.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat<<EOF>>/etc/bak.exclude | |
./etc/.pwd.lock | |
./etc/machine-id | |
./etc/mtab | |
./etc/multipath/bindings | |
./etc/openldap/schema | |
./etc/os-release | |
./etc/resolv.conf | |
./etc/ssh/ssh_host_* | |
EOF | |
cat<<EOF>>/etc/bak.include | |
./etc | |
./root/.ssh/authorized_keys | |
./var/lib/letsencrypt | |
EOF | |
cat<<EOF>>/etc/bak | |
#!/bin/sh | |
bak=/bak.\$(date -I).tar.gz | |
tar -C / -acpf \${1:-\${bak}} --exclude-from=/etc/bak.exclude --files-from=/etc/bak.include | |
EOF | |
chmod +x /etc/bak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this to save and clone my Clear Linux machines. The 'exclude' files are typical Clear Linux files that I want to drop.