Clear docker command added
This commit is contained in:
40
Clear.sh
40
Clear.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
Version="1.0"
|
Version="1.1"
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
# Reset
|
# Reset
|
||||||
@@ -159,27 +159,21 @@ function deleteOldestInstallFusion360 () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#clearKeepFolder() {
|
clearDocker() {
|
||||||
# # Evals to workaround spaces in arguments
|
if docker_exists="$(type -p "docker")" || [[ -z $docker_exists ]];
|
||||||
# eval folderPath="$2"
|
then
|
||||||
# eval clearableName="$1"
|
echo "${BarColor}====== ${ClearableNameColor}Docker ${BarColor}======${Color_Off}"
|
||||||
|
if [ "$(docker ps -a -q | wc -l)" -gt "0" ];
|
||||||
# echo "${BarColor}====== ${ClearableNameColor}${clearableName} ${BarColor}======${Color_Off}"
|
then
|
||||||
# echo "Checking for ${ClearableNameColor}${clearableName}${Color_Off}'s cache folder..."
|
echo "Found running docker containers, stopping them..."
|
||||||
|
docker stop $(docker ps -a -q)
|
||||||
# if [ -n "$(ls -d ${folderPath}/* 2>/dev/null)" ];
|
docker rm $(docker ps -a -q)
|
||||||
# then
|
fi
|
||||||
# echo "${FoundText}"
|
docker system prune --all --force
|
||||||
|
else
|
||||||
# echo "Clearing ${ClearableNameColor}${clearableName}${Color_Off}'s cache... ${SizeColor}($(du -sh ${folderPath} | cut -f1))${Color_Off}"
|
echo "${ClearableNameColor}Docker${Color_Off} was ${NotFoundColor}not found${Color_Off}."
|
||||||
# echo ${folderPath}
|
fi
|
||||||
# cleared=$(($cleared+$(du -sk ${folderPath} | cut -f1)))
|
}
|
||||||
|
|
||||||
# sudo rm -rvi ${folderPath}/* | pv -l -s $(du -a ${folderPath} | wc -l)> /dev/null
|
|
||||||
# else
|
|
||||||
# echo "${ClearableNameColor}${clearableName}${Color_Off}'s cache ${NotFoundColor}not found${Color_Off}."
|
|
||||||
# fi
|
|
||||||
#}
|
|
||||||
|
|
||||||
clearFolder() {
|
clearFolder() {
|
||||||
# Evals to workaround spaces in arguments
|
# Evals to workaround spaces in arguments
|
||||||
@@ -248,6 +242,8 @@ clearFolder "Adobe" "${Adobe}"
|
|||||||
|
|
||||||
deleteOldestInstallFusion360
|
deleteOldestInstallFusion360
|
||||||
|
|
||||||
|
clearDocker
|
||||||
|
|
||||||
|
|
||||||
# Print final
|
# Print final
|
||||||
echo "${BarColor}==========================================${Color_Off}"
|
echo "${BarColor}==========================================${Color_Off}"
|
||||||
|
|||||||
Reference in New Issue
Block a user