Added a simple progress bar
This commit is contained in:
parent
5b87072b11
commit
e331dda080
@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
___
|
___
|
||||||
## :bell: Changelog
|
## :bell: Changelog
|
||||||
|
- **v0.3.5**: Added a simple progress bar for the registry checkup.
|
||||||
- **v0.3.4**: Added ntfy.sh template and error message on registry fail.
|
- **v0.3.4**: Added ntfy.sh template and error message on registry fail.
|
||||||
- **v0.3.3**: Added Apprise template and the option `-i` inform - to send notifications.
|
- **v0.3.3**: Added Apprise template and the option `-i` inform - to send notifications.
|
||||||
- **v0.3.2**: Added a notify function to wrap a notify-script, currently DSM/Ssmtp + template script.
|
- **v0.3.2**: Added a notify function to wrap a notify-script, currently DSM/Ssmtp + template script.
|
||||||
- **v0.3.1**: Addded option `-m` , monochrome mode - no printf color codes.
|
- **v0.3.1**: Addded option `-m` , monochrome mode - no printf color codes.
|
||||||
- **v0.3.0**: Added option `-d N`, age (days) new images have to be before being pulled and updated.
|
- **v0.3.0**: Added option `-d N`, age (days) new images have to be before being pulled and updated.
|
||||||
- **v0.2.6**: regctl check / download logic changed. Now using the scripts directory as primary location.
|
|
||||||
___
|
___
|
||||||
|
|
||||||
## :nut_and_bolt: Dependencies
|
## :nut_and_bolt: Dependencies
|
||||||
|
23
dockcheck.sh
23
dockcheck.sh
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION="v0.3.4"
|
VERSION="v0.3.5"
|
||||||
### ChangeNotes: Added ntfy.sh template and error message on registry fail.
|
### ChangeNotes: Added a simple handcrafted progress bar.
|
||||||
Github="https://github.com/mag37/dockcheck"
|
Github="https://github.com/mag37/dockcheck"
|
||||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||||
|
|
||||||
@ -128,6 +128,17 @@ datecheck() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progress_bar() {
|
||||||
|
QueCurrent="$1"
|
||||||
|
QueTotal="$2"
|
||||||
|
((Percent=100*${QueCurrent}/${QueTotal}))
|
||||||
|
((Complete=50*${Percent}/100)) # change first number for width (50)
|
||||||
|
((Left=50-${Complete})) # change first number for width (50)
|
||||||
|
BarComplete=$(printf "%${Complete}s" | tr " " "#")
|
||||||
|
BarLeft=$(printf "%${Left}s" | tr " " "-")
|
||||||
|
[[ $QueTotal == $QueCurrent ]] || printf "\r[%s%s] %s/%s " $BarComplete $BarLeft $QueCurrent $QueTotal
|
||||||
|
[[ $QueTotal == $QueCurrent ]] && printf "\r[%b%s%b] %s/%s \n" $c_teal $BarComplete $c_reset $QueCurrent $QueTotal
|
||||||
|
}
|
||||||
|
|
||||||
### Version check & initiate self update
|
### Version check & initiate self update
|
||||||
[[ "$VERSION" != "$LatestRelease" ]] && { printf "New version available! Local: %s - Latest: %s \n Change Notes: %s \n" "$VERSION" "$LatestRelease" "$LatestChanges" ; [[ -z "$AutoUp" ]] && self_update_select ; }
|
[[ "$VERSION" != "$LatestRelease" ]] && { printf "New version available! Local: %s - Latest: %s \n Change Notes: %s \n" "$VERSION" "$LatestRelease" "$LatestChanges" ; [[ -z "$AutoUp" ]] && self_update_select ; }
|
||||||
@ -190,11 +201,16 @@ if [[ -n ${Excludes[*]} ]] ; then
|
|||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Variables for progress_bar function
|
||||||
|
DocCount=$(docker ps --filter "name=$SearchName" --format '{{.Names}}' | wc -l)
|
||||||
|
RegCheckQue=0
|
||||||
|
|
||||||
### Check the image-hash of every running container VS the registry
|
### Check the image-hash of every running container VS the registry
|
||||||
for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') ; do
|
for i in $(docker ps $Stopped --filter "name=$SearchName" --format '{{.Names}}') ; do
|
||||||
|
((RegCheckQue+=1))
|
||||||
|
progress_bar $RegCheckQue $DocCount
|
||||||
### Looping every item over the list of excluded names and skipping:
|
### Looping every item over the list of excluded names and skipping:
|
||||||
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
|
for e in "${Excludes[@]}" ; do [[ "$i" == "$e" ]] && continue 2 ; done
|
||||||
printf ". "
|
|
||||||
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
RepoUrl=$(docker inspect "$i" --format='{{.Config.Image}}')
|
||||||
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
|
LocalHash=$(docker image inspect "$RepoUrl" --format '{{.RepoDigests}}')
|
||||||
### Checking for errors while setting the variable:
|
### Checking for errors while setting the variable:
|
||||||
@ -301,3 +317,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user