Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21386

General • Send Log by Email

$
0
0
Hi,

I have a script in my ROUTEROS for renewing the Let's Encrypt certificate used by my SSTP VPN Server.
Works fine on the RB4011 that I have at my apartment, but doesn't run at the main site (where the VPN actually runs from) when executed by the scheduler, but will run fine when executed manually.
The script has READ And WRITE permissions, and we even tried the "don't require permissions" option... but as I say, doesn't seem to run properly when executed by the scheduler, but will run fine when executed manually.

I've added loads of logging statements to the script:
Code:
:log info "Script - Certificate renewal start":local commName "[REMOVED FOR PRIVACY]"/ip service set disabled=no [find where name="www"]/ip firewall filter enable [find where comment="LetsEncrypt"]#Delete old certificate, create new certificate/certificate remove [find where common-name=$commName]/certificate enable-ssl-certificate dns=$commName :delay 60s/certificate :local certName [get [find where common-name=$commName] name]#Set new certificate in SSTP Profile/interface sstp-server server set certificate=$certName/ip service set disabled=yes [find where name="www"]/ip firewall filter disable [find where comment="LetsEncrypt"]:log info "Script - Certificate renewal finished"
Is there a way that I can get the logging output from the script to be sent via email to me after execution, or get it to save the log to a file and then get that file sent to me by email (I've seen a couple of example scripts for emailing backup files already, so if saving the log to a file is possible, I guess this would be quite easy).

Any thoughts anyone?

Thanks in advance.

Colin

Statistics: Posted by ColinSlater — Mon Feb 03, 2025 11:57 pm



Viewing all articles
Browse latest Browse all 21386

Trending Articles