added slstatus

This commit is contained in:
wt committed 2024-11-06 00:35:34 +07:00
1 parent 2eee2f75c0
commit 89e5167279
39 files changed
+3002 -1

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# This function checks if wttr.in is available before the weather info is fetched
ck_curl() {
curl -sf ru.wttr.in > /dev/null
}
ck_curl
if [ $? -eq 0 ] # $? means "output of the last command"
then
curl -s v2.wttr.in/tomsk?format="%t\n" > /tmp/wttr
wttr_net=1
else # Non-zero output would appear both when the site \
for (( cntr = 0; cntr < 3; cntr++ )) # is down and when you're physically offline
do
echo "Probing. " > /tmp/wttr
sleep 0.5
echo "Probing.. " > /tmp/wttr
sleep 0.5
echo "Probing..." > /tmp/wttr
sleep 0.5 # A wee bit of animation
done
ck_curl # Online check is rerun only once, if the first check fails.
fi # In case you're using wifi, and the cron job runs before \
# it authenticates
if ! [ $wttr_net ]
then echo "Offline fr :'( " > /tmp/wttr
fi