Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Variables
- dir="/home/name"
- dir_Plex="/home/name/Plex/*"
- dir_du=$(du -s $dir | cut -f1)
- txt="/mnt/logs/name-share-size.txt"
- qck_math=$(($dir_du/1048576))
- qck_maths=$qck_math"GB"
- # ===============================================
- #
- # Color
- lb=`echo -e "\e[94m"`
- rd=`echo -e "\e[31m"`
- clr=`echo -e "\e[0m"`
- # ==============================================
- #
- # ifs
- if [ $qck_math -ge "100" ]; then
- math_color=$rd
- chmod -w $dir_Plex
- txt3="Removing write permissions now."
- else
- math_color=$lb
- chmod +w $dir_Plex
- txt3="Granting write permissions now."
- fi
- # or this supposedly
- # [ $qck_math -ge "100" ] && math_color=$rd && chmod -w $dir_Plex || math_color=$lb &^ chmod +w $dir_Plex
- # ===============================================
- #
- # Computer speaking:
- # txt1
- echo "" >> $txt
- date=$lb$(date +%D)$clr" - "$lb$(date +%H"u"%M"m"%S"s")$clr
- echo "$date - $lb"Computer"$clr: Checking the folder size now." >> $txt
- # txt2
- date=$lb$(date +%D)$clr" - "$lb$(date +%H"u"%M"m"%S"s")$clr
- echo "$date - $lb"Computer"$clr: $lb$dir$clr is $math_color$qck_maths$clr." >> $txt
- # txt3
- date=$lb$(date +%D)$clr" - "$lb$(date +%H"u"%M"m"%S"s")$clr
- echo "$date - $lb"Computer"$clr: $txt3" >> $txt
- 27,1 Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement