lainchan-webring

Code for the unofficial lainchan webring.
git clone git://git.concealed.world/lainchan-webring
Log | Files | Refs | README | LICENSE

commit 7d9519803dbc6ab43a10c0f1393cf19d4bf54bdc
parent db302e0188e3f9cfec3c6af6916707035912bd68
Author: Nixx <nixx@firemail.cc>
Date:   Fri, 28 May 2021 01:40:27 +0100

Account for the possibility of a new domain being added to the text file

Diffstat:
Mcheck-up | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/check-up b/check-up @@ -38,8 +38,13 @@ doconnections () { DOMAIN=$(head -n $COUNT "${1}" | tail -n 1) # Find the domain in the output file POSITION=$(grep -n "^${DOMAIN} " "${2}" | cut -d : -f 1) - # And get the current number of occurences it has been down - DOWNFOR=$(head -n $POSITION "${2}" | tail -n 1 | cut -d \ -f 2) + if [ -z $POSITION ]; then + # If the domain is a new addition + DOWNFOR=0 + else + # Get the current number of occurences it has been down + DOWNFOR=$(head -n $POSITION "${2}" | tail -n 1 | cut -d \ -f 2) + fi # If it doesn't connect, increment if ! timeout $WAIT ${TORSOCKS} curl -s "$DOMAIN" > /dev/null; then