Skip to content

Commit

Permalink
add countdown (#691)
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch85 authored Oct 15, 2018
1 parent 1a2b772 commit d66d5cf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 2 additions & 8 deletions apps/fulltextsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,9 @@ docker run -d --restart always \
-e "discovery.type=single-node" \
-i -t $nc_fts

# Wait for bootstraping
docker restart $fts_es_name

echo "Waiting for docker bootstraping..."
secs=$((20))
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
countdown "Waiting for docker bootstraping..." "20"
docker logs $fts_es_name

# Get Full Text Search app for nextcloud
Expand Down
11 changes: 11 additions & 0 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,17 @@ You will be given the option to abort when you hit OK."
fi
}

# countdown 'message looks like this' 10
countdown() {
echo "$1"
secs="$(($2))"
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
}

## bash colors
# Reset
Color_Off='\e[0m' # Text Reset
Expand Down
6 changes: 2 additions & 4 deletions nextcloud_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ else
rm -f "$STABLEVERSION.tar.bz2"
fi

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

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

0 comments on commit d66d5cf

Please sign in to comment.