mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
daily-psk: add error handling for fetch
This commit is contained in:
parent
bfca11c9ad
commit
96fbb41b7e
1 changed files with 9 additions and 4 deletions
13
daily-psk
13
daily-psk
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
# return pseudo-random string for PSK
|
# return pseudo-random string for PSK
|
||||||
:local GeneratePSK do={
|
:local GeneratePSK do={
|
||||||
:local date $1;
|
:local date [ :tostr $1 ];
|
||||||
|
|
||||||
:global "daily-psk-secrets";
|
:global "daily-psk-secrets";
|
||||||
|
|
||||||
|
@ -84,9 +84,14 @@
|
||||||
"&level=1" . \
|
"&level=1" . \
|
||||||
"&ssid=" . $ssid . \
|
"&ssid=" . $ssid . \
|
||||||
"&pass=" . $newpsk);
|
"&pass=" . $newpsk);
|
||||||
|
:local attach "qrcode-daily.png";
|
||||||
|
|
||||||
/ tool fetch mode=https check-certificate=yes-without-crl address=$host host=$host \
|
:do {
|
||||||
src-path=$srcpath dst-path=qrcode-daily.png;
|
/ tool fetch mode=https check-certificate=yes-without-crl address=$host \
|
||||||
|
host=$host src-path=$srcpath dst-path=$attach;
|
||||||
|
} on-error={
|
||||||
|
:set attach "";
|
||||||
|
}
|
||||||
|
|
||||||
$SendNotification ("[" . $identity . "] daily PSK " . $ssid) \
|
$SendNotification ("[" . $identity . "] daily PSK " . $ssid) \
|
||||||
("This is the daily PSK on " . $identity . ":\n\n" . \
|
("This is the daily PSK on " . $identity . ":\n\n" . \
|
||||||
|
@ -94,7 +99,7 @@
|
||||||
"PSK: " . $newpsk . "\n" . \
|
"PSK: " . $newpsk . "\n" . \
|
||||||
"Date: " . [ / system clock get date ] . "\n\n" . \
|
"Date: " . [ / system clock get date ] . "\n\n" . \
|
||||||
"https://" . $host . $srcpath) \
|
"https://" . $host . $srcpath) \
|
||||||
"qrcode-daily.png";
|
$attach;
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
:log debug ("Missing active interface " . $intname . " for access list entry.");
|
:log debug ("Missing active interface " . $intname . " for access list entry.");
|
||||||
|
|
Loading…
Reference in a new issue