mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
v-df-snapshot-make tweaks and snapshot for /hdd
This commit is contained in:
parent
3faa448a32
commit
04453ebca2
1 changed files with 39 additions and 7 deletions
|
@ -6,13 +6,45 @@ folder="/usr/local/vesta/data/df"
|
|||
|
||||
mkdir -p $folder
|
||||
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
|
||||
du --max-depth=1 -c -m -x / > $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=1 -c -m -x /home >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=2 -c -m -x /home >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=3 -c -m -x /home >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=6 -c -m -x /home >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=1 -c -m -x /var/lib/mysql >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=1 -c -m -x /var/log >> $folder/snapshot-$timestamp.txt
|
||||
|
||||
du --max-depth=1 -m -x / > $folder/snapshot-$timestamp.txt
|
||||
|
||||
du --max-depth=6 -m -x /home > $folder/snapshot-temp.txt
|
||||
for i in {2..7}; do
|
||||
while IFS= read -r line; do
|
||||
count=0
|
||||
for (( j=0; j<${#line}; j++ )); do
|
||||
if [[ ${line:j:1} == "/" ]]; then
|
||||
((count++))
|
||||
fi
|
||||
done
|
||||
if [ $count -eq $i ]; then
|
||||
printf '%s\n' "$line" >> $folder/snapshot-$timestamp.txt
|
||||
fi
|
||||
done < $folder/snapshot-temp.txt
|
||||
done
|
||||
rm $folder/snapshot-temp.txt
|
||||
|
||||
if [ -d "/hdd" ]; then
|
||||
du --max-depth=7 -m -x /hdd > $folder/snapshot-temp.txt
|
||||
for i in {1..8}; do
|
||||
while IFS= read -r line; do
|
||||
count=0
|
||||
for (( j=0; j<${#line}; j++ )); do
|
||||
if [[ ${line:j:1} == "/" ]]; then
|
||||
((count++))
|
||||
fi
|
||||
done
|
||||
if [ $count -eq $i ]; then
|
||||
printf '%s\n' "$line" >> $folder/snapshot-$timestamp.txt
|
||||
fi
|
||||
done < $folder/snapshot-temp.txt
|
||||
done
|
||||
rm $folder/snapshot-temp.txt
|
||||
fi
|
||||
|
||||
du --max-depth=1 -m -x /var/lib/mysql >> $folder/snapshot-$timestamp.txt
|
||||
du --max-depth=1 -m -x /var/log >> $folder/snapshot-$timestamp.txt
|
||||
|
||||
chmod 600 $folder/snapshot-$timestamp.txt
|
||||
chown root:root $folder/snapshot-$timestamp.txt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue