Good Day!
I’m newbie in Mikrotik Scripting and have the next problem.
I use Winbox and write scripts by GUI (not by terminal), version 6.33.1, hardware RB2011UAiS
For first I’m creating a log file of my activity of firewall (netmap port)
it called firewalllog.0.txt
Everything is allright - it works. Than I sent it everynight at 23.55 by sheduler
The script is next
:local pingcount 5;
:local hostping google.com;
:local pingresultA [/ping $hostping count=$pingcount];
:if ($pingresultA > 0) do={
/tool e-mail send to="xxx@gmail.com" subject=("xxxxx" . [/system clock get date]) file="firewalllog.0.txt" body=("xxx" . [/system clock get date]);
};
It works fine but I want to delete file after sending so I modify script
:local pingcount 5;
:local hostping google.com;
:local pingresultA [/ping $hostping count=$pingcount];
:if ($pingresultA > 0) do={
/tool e-mail send to="xxx@gmail.com" subject=("xxxxx" . [/system clock get date]) file="firewalllog.0.txt" body=("xxx" . [/system clock get date]);
/file remove firewalllog.0.log;
};
Script works fine but after it removes file - the new file with new lines doesnt create
It only creates when I open System-Logging- MyRule and click OK or Apply (resave)
Can anybody help me =)?