Script read variable after reboot

Hi

Can you help me with script that save/read variable beacause after reboot i loss counter :confused:

My Mikrotik is a HotSpot and I must read from it a some statistic's like a number of the currently logged-in users and count of the total number of logins.
I do this by this script:
#total logins
:global counter
:set counter ($counter + 1)
/system script environment print file=licznik.txt

it's put in ip->hotspot->user profile->scripts->on login

I try save variable to file by this line "/system script environment print file=licznik.txt" but this create something like that:

jun/17/2016 12: 0:11 by RouterOS 6.35.4

software id =

name: counter
value: 3

I Try read content of file licznik.txt by
:global counter
:set counter [/file get licz.txt content];
but this lines creat variable counter with all other text that is in file licznik.txt

Can you help me with my idea or maby You have beter solution for this ?

Do you want to do that for each user or for all of them ?

hmm i think that you don’t understand me ;p

After mikrotik reboot i lose counter ( system-script-environment ) but i don’t want lose this counter :slight_smile: and it is all i need :slight_smile:

You could save the counter in a comment somewhere.