aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local')
-rwxr-xr-xdotfiles/.local/bin/barweather5
-rwxr-xr-xdotfiles/.local/bin/newssync10
-rwxr-xr-xdotfiles/.local/bin/pacsync5
-rwxr-xr-xdotfiles/.local/bin/pacupgrade4
4 files changed, 21 insertions, 3 deletions
diff --git a/dotfiles/.local/bin/barweather b/dotfiles/.local/bin/barweather
index da8f25f..042fc52 100755
--- a/dotfiles/.local/bin/barweather
+++ b/dotfiles/.local/bin/barweather
@@ -10,7 +10,10 @@ if [ -n "$location" ]; then
fi
update_forecast() {
- ping -q -c 1 1.1.1.1 >/dev/null || exit
+ # Check several times before giving up, useful when just waking up from sleep
+ # since internet is usually not available right away
+ wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+
forecast=$(curl -s wttr.in/"$location"?format=1)
if [ ${#forecast} -lt 30 ]; then
printf "%s\n" "$forecast" > "$cachefile"
diff --git a/dotfiles/.local/bin/newssync b/dotfiles/.local/bin/newssync
index 0c0e866..607188d 100755
--- a/dotfiles/.local/bin/newssync
+++ b/dotfiles/.local/bin/newssync
@@ -1,7 +1,15 @@
#!/bin/sh
-ping -q -c 1 1.1.1.1 > /dev/null || exit
+# Don't try to update feed if newsboat is already running
+if pidof newsboat; then
+ exit
+fi
+# Check several times before giving up, useful when just waking up from sleep
+# since internet is usually not available right away
+wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+
+# Source the needed env variables so that it can function properly from cron
. ~/.cache/sessionenv
touch ~/.cache/newssynclive
diff --git a/dotfiles/.local/bin/pacsync b/dotfiles/.local/bin/pacsync
index 30fc98c..f96996a 100755
--- a/dotfiles/.local/bin/pacsync
+++ b/dotfiles/.local/bin/pacsync
@@ -1,10 +1,13 @@
#!/bin/sh
+# Don't try to sync if pacman is already running
if pidof pacman; then
exit
fi
-ping -q -c 1 1.1.1.1 > /dev/null || exit
+# Check several times before giving up, useful when just waking up from sleep
+# since internet is usually not available right away
+wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
# Source the needed env variables so that it can function properly from cron
. ~/.cache/sessionenv
diff --git a/dotfiles/.local/bin/pacupgrade b/dotfiles/.local/bin/pacupgrade
index 4aa4512..aa00575 100755
--- a/dotfiles/.local/bin/pacupgrade
+++ b/dotfiles/.local/bin/pacupgrade
@@ -1,6 +1,10 @@
#!/bin/sh
+# This is just a wrapper script to upgrade system AND update status bar module
+
+# Don't try to sync if pacman is already running
if pidof pacman; then
+ echo "pacman is already running"
exit
fi