add retry when kdeconnect-cli fail
This commit is contained in:
parent
9990b69ea2
commit
56bddc13d7
12
send-sms
12
send-sms
|
@ -42,8 +42,11 @@ fi
|
||||||
|
|
||||||
if [ -n "$PHONE" ]; then
|
if [ -n "$PHONE" ]; then
|
||||||
TMP_FILE="/tmp/send-sms-$(tr -dc "qwertQWERTasdfgASDFGzxcvbZXCVB" < /dev/urandom | head -c 16)"
|
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_FILE"
|
||||||
|
touch "$TMP_FILE2"
|
||||||
chmod 600 "$TMP_FILE"
|
chmod 600 "$TMP_FILE"
|
||||||
|
chmod 600 "$TMP_FILE2"
|
||||||
|
|
||||||
vim "$TMP_FILE"
|
vim "$TMP_FILE"
|
||||||
|
|
||||||
|
@ -51,7 +54,13 @@ if [ -n "$PHONE" ]; then
|
||||||
whiptail --textbox "$TMP_FILE" --title "SMS pour $PHONE" 15 70
|
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
|
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
|
else
|
||||||
printf "Aborded!\\n"
|
printf "Aborded!\\n"
|
||||||
fi
|
fi
|
||||||
|
@ -60,4 +69,5 @@ if [ -n "$PHONE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "$TMP_FILE"
|
rm "$TMP_FILE"
|
||||||
|
rm "$TMP_FILE2"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue