i want to save tx-bytes from interface to text file and update it every 1hour
can any body help my
![]()
/interface {
:local tx
:local name
:local fname
:local fcontent 0
:fore s in=[/interface find] do={
:set tx [get $s tx-byt]
:set tx ($tx / 1048576)
:set name [get $s name]
:set name ("Mostafa_".$name.".txt")
#:put $name
:fore i in=[/file find] do={
:set fname [/file get $i name]
:if ($name != $fname) do={
/file print file=$name;
:delay 2s
/file set $name contents="$tx";
} else={
:put "*****************************************"
:put "found !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
:put $name
:put $fname
:put "*****************************************"
:set fcontent [/file get $name contents];
:set fcontent ($fcontent/1048576)
:put $fcontent
:if ($fcontent < $tx) do={
:put "$fcontent < $tx"
:set fcontent $tx
/file set $name contents="$fcontent";
} else={
:if ($fcontent > $tx) do={
:put "$fcontent > $tx"
:set fcontent [$tx - $fcontent]
:set fcontent [$fcontent + $tx]
/file set $name contents="$fcontent";
}
}
}
}
}
}