mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
telegram-chat: create status files with /file/add
We have no content, thus no issues with file size.
This commit is contained in:
parent
66ebcf2bbd
commit
557823c5c1
1 changed files with 4 additions and 4 deletions
|
@ -106,12 +106,12 @@ $WaitFullyConnected;
|
||||||
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
|
:local File ("tmpfs/telegram-chat/" . [ $GetRandom20CharAlNum 6 ]);
|
||||||
$MkDir "tmpfs/telegram-chat";
|
$MkDir "tmpfs/telegram-chat";
|
||||||
$LogPrintExit2 info $0 ("Running command from update " . $UpdateID . ": " . $Text) false;
|
$LogPrintExit2 info $0 ("Running command from update " . $UpdateID . ": " . $Text) false;
|
||||||
:execute script=(":do {\n" . $Text . "\n} on-error={ :execute script=\"/\" file=" . $File . ".failed };" . \
|
:execute script=(":do {\n" . $Text . "\n} on-error={ /file/add name=\"" . $File . ".failed\" };" . \
|
||||||
":execute script=\"/\" file=" . $File . ".done") file=$File;
|
"/file/add name=\"" . $File . ".done\"") file=$File;
|
||||||
:if ([ $WaitForFile ($File . ".done.txt") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={
|
:if ([ $WaitForFile ($File . ".done") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={
|
||||||
:set State "The command did not finish, still running in background.\n\n";
|
:set State "The command did not finish, still running in background.\n\n";
|
||||||
}
|
}
|
||||||
:if ([ :len [ /file/find where name=($File . ".failed.txt") ] ] > 0) do={
|
:if ([ :len [ /file/find where name=($File . ".failed") ] ] > 0) do={
|
||||||
:set State "The command failed with an error!\n\n";
|
:set State "The command failed with an error!\n\n";
|
||||||
}
|
}
|
||||||
:local Content [ /file/get ($File . ".txt") contents ];
|
:local Content [ /file/get ($File . ".txt") contents ];
|
||||||
|
|
Loading…
Reference in a new issue