-
Notifications
You must be signed in to change notification settings - Fork 4
/
checkDisk.sh
26 lines (25 loc) · 972 Bytes
/
checkDisk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/bash
source $HOME/.bash_profile
size=$(df -m / | grep -vE '^Filesystem|tmpfs|cdrom|loop|overlay|sda' | awk '{ print $4*1}')
echo "disk space "$size
size1=300
if [ $size -gt $size1 ]; then
echo "space disk enough"
else
echo "disk space more then 99%. reinstall all docker container"
docker stop $(docker ps -qf "name=^exorde")
sleep 5
docker rm -f $(docker ps -a -qf "name=^exorde")
sleep 5
if [ $size == 0 ]; then
yes | docker system prune -a && yes | docker image prune && yes | docker rmi $(docker images -a -q) && yes | docker volume prune
fi
echo "installing new worker by bash profile variable"
for (( i=1; i<=$maxWorker; i++ ))
do
name="exorde"$i
echo "Create container $name"
docker run -d --cpus="2" --memory="16g" --restart unless-stopped --pull always --name $name exordelabs/exorde-client --main_address $mainAddress --only youtube,reddit,4chan
sleep 1
done
fi