Skip to content

Commit d66d5cf

Browse files
authored
add countdown (#691)
1 parent 1a2b772 commit d66d5cf

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

apps/fulltextsearch.sh

+2-8
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,9 @@ docker run -d --restart always \
107107
-e "discovery.type=single-node" \
108108
-i -t $nc_fts
109109

110+
# Wait for bootstraping
110111
docker restart $fts_es_name
111-
112-
echo "Waiting for docker bootstraping..."
113-
secs=$((20))
114-
while [ $secs -gt 0 ]; do
115-
echo -ne "$secs\033[0K\r"
116-
sleep 1
117-
: $((secs--))
118-
done
112+
countdown "Waiting for docker bootstraping..." "20"
119113
docker logs $fts_es_name
120114

121115
# Get Full Text Search app for nextcloud

lib.sh

+11
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,17 @@ You will be given the option to abort when you hit OK."
824824
fi
825825
}
826826

827+
# countdown 'message looks like this' 10
828+
countdown() {
829+
echo "$1"
830+
secs="$(($2))"
831+
while [ $secs -gt 0 ]; do
832+
echo -ne "$secs\033[0K\r"
833+
sleep 1
834+
: $((secs--))
835+
done
836+
}
837+
827838
## bash colors
828839
# Reset
829840
Color_Off='\e[0m' # Text Reset

nextcloud_update.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ else
173173
rm -f "$STABLEVERSION.tar.bz2"
174174
fi
175175

176-
echo "Backing up files and upgrading to Nextcloud $NCVERSION in 10 seconds..."
177-
echo "Press CTRL+C to abort."
178-
sleep 10
176+
countdown "Backing up files and upgrading to Nextcloud $NCVERSION in 10 seconds... Press CTRL+C to abort." "10"
179177

180178
# Stop Apache2
181179
check_command service apache2 stop
@@ -313,7 +311,7 @@ then
313311
echo
314312
printf "${Green}All files are backed up.${Color_Off}\n"
315313
occ_command maintenance:mode --on
316-
echo "Removing old Nextcloud instance in 5 seconds..." && sleep 5
314+
countdown "Removing old Nextcloud instance in 5 seconds..." "5"
317315
rm -rf $NCPATH
318316
tar -xjf "$HTML/$STABLEVERSION.tar.bz2" -C "$HTML"
319317
rm "$HTML/$STABLEVERSION.tar.bz2"

0 commit comments

Comments
 (0)