Browse Source

add retry when kdeconnect-cli fail

master
Simon Vieille 3 weeks ago
parent
commit
56bddc13d7
Signed by: Simon Vieille <simon@deblan.fr> GPG Key ID: 03383D15A1D31745
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      send-sms

+ 11
- 1
send-sms View File

@@ -42,8 +42,11 @@ fi

if [ -n "$PHONE" ]; then
TMP_FILE="/tmp/send-sms-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
TMP_FILE2="/tmp/send-sms-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
touch "$TMP_FILE"
touch "$TMP_FILE2"
chmod 600 "$TMP_FILE"
chmod 600 "$TMP_FILE2"

vim "$TMP_FILE"

@@ -51,7 +54,13 @@ if [ -n "$PHONE" ]; then
whiptail --textbox "$TMP_FILE" --title "SMS pour $PHONE" 15 70

if (whiptail --title "Confirmation" --yesno "Valides-tu l'expédition du SMS ?" 8 50 3>&1 1>&2 2>&3) then
kdeconnect-cli --device "$DEVICE" --send-sms "$(cat "$TMP_FILE")" --destination "$PHONE"
kdeconnect-cli --device "$DEVICE" --send-sms "$(cat "$TMP_FILE")" --destination "$PHONE" > "$TMP_FILE2" 2>&1

if [ ! $? -eq 0 ]; then
if (whiptail --title "Confirmation" --yesno "$(cat $TMP_FILE2)\nEssayer à nouveau ?" 12 50 3>&1 1>&2 2>&3) then
kdeconnect-cli --device "$DEVICE" --send-sms "$(cat "$TMP_FILE")" --destination "$PHONE"
fi
fi
else
printf "Aborded!\\n"
fi
@@ -60,4 +69,5 @@ if [ -n "$PHONE" ]; then
fi

rm "$TMP_FILE"
rm "$TMP_FILE2"
fi

Loading…
Cancel
Save