Created
December 7, 2020 19:44
-
-
Save zkylab/c8a81ec42ca26c0af982f41f533a4e86 to your computer and use it in GitHub Desktop.
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
# 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