Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script that calls dump with an exclude list
#!/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