
I want to email current user's info
as:
current users:7xh2vemh,uptime:12h32m;30i7sz9h,uptime:1d12h30m;hrv6xi7a,uptime:17h32m;tr22ayeq,uptime:12h32m;djip9r2c,uptime:12h32m;
how to script?
thank you!{
/file print file=File.txt
/file set File.txt contents="current users:"
:foreach user in=[/ip hotspot active find] do={
:local name [/ip hotspot active get $user user];
:local uptime [/ip hotspot active get $user uptime];
:local content [/file get File.txt contents];
/file set File.txt contents="$content,$name,uptime:$uptime"
}
}
This will give you output like this:
current users:7xh2vemh,uptime:12h32m;30i7sz9h,uptime:1d12h30m;hrv6xi7a,uptime:17h32m;tr22ayeq,uptime:12h32m;djip9r2c,uptime:12h32m;
Divide by 1048576 (which is 1024 * 1024). One thing to keep in mind is that RouterOS will round to whole numbers, so doing something like 3000000/1048576 = 2.how can I convert "downbyte " to MiB???
:local downMB ($downbyte / 1048576)