Created
July 30, 2021 14:27
-
-
Save UnixSage/674826f4e83adfe3eabec1ee998b75cc to your computer and use it in GitHub Desktop.
Shell script that calls dump with an exclude list
This file contains 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 | |
if [ $# = 2 ] ; then | |
NODENAME=$1 | |
LEVEL=$2 | |
elif [ $# = 1 ] ; then | |
NODENAME=$HOSTNAME | |
LEVEL=$1 | |
else | |
NODENAME=$HOSTNAME | |
LEVEL=0 | |
fi | |
SKIPLIST=" | |
/usr | |
/data | |
/var/lib/flatpak | |
/var/cache | |
/home/SomeUser/.cache | |
" | |
INODELIST=`ls -1id ${SKIPLIST} | awk '{ORS=","; if($1 != "2") {print $1}}' | sed 's/,$//'` | |
DATESTAMP=`date +'%Y%m%d%H%M'` | |
echo dump -u -e ${INODELIST} -${LEVEL} -L ${DATESTAMP}-${LEVEL} -f ${NODENAME}.${DATESTAMP}-root-${LEVEL}.dmp / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment