Skip to content

Instantly share code, notes, and snippets.

@zkylab
Created December 7, 2020 19:44
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 zkylab/c8a81ec42ca26c0af982f41f533a4e86 to your computer and use it in GitHub Desktop.
Save zkylab/c8a81ec42ca26c0af982f41f533a4e86 to your computer and use it in GitHub Desktop.
# usage : sudo bash archiveMaster.sh
today=$(date +"%Y-%m-%d")
archiveFileName="$(whoami)_home_$today.tgz"
tar -cvzf $archiveFileName /home/*
archiveCounterCommand="tar -tzf $archiveFileName | wc -l"
archiveFileCounter=$(eval "$archiveCounterCommand")
homeFileCounterCommand="find /home/* | wc -l"
homeFileCounter=$(eval "$homeFileCounterCommand")
echo $homeFileCounter . "and" . $archiveFileCounter
if [[ $homeFileCounter -eq $archiveFileCounter ]]
then
echo "Arşiv Uygundur."
else
echo "Arşiv hatalıdır, lütfen tekrar deneyiniz"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment