0% found this document useful (0 votes)
264 views

Scheduler User Profiles Script

The document configures a system scheduler to run a script every 5 seconds that fetches data from a URL, parses the response to extract user credentials, and adds a new hotspot user if valid credentials are found. It also defines several hotspot user profiles that schedule the removal of the user and associated voucher after different time periods.

Uploaded by

Mclava Rey
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
264 views

Scheduler User Profiles Script

The document configures a system scheduler to run a script every 5 seconds that fetches data from a URL, parses the response to extract user credentials, and adds a new hotspot user if valid credentials are found. It also defines several hotspot user profiles that schedule the removal of the user and associated voucher after different time periods.

Uploaded by

Mclava Rey
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/system scheduler

add interval=5s name="code on demand" on-event="{:global result [/tool fetch h\


ttp-method=get http-content-type=\"text/html\" url=\"http://192.168.77.5/g\
\" as-value output=user]; put (\$result);:if (\$result->\"status\" = \"fin\
ished\") do={:global mdata (\$result->\"data\"); :if (\$result->\"data\" =\
\_\"x\") do={} else={:global sep [:find \$mdata \":\" -1]; :global sef [:f\
ind \$mdata \"*\" -1];:global user [:pick \$mdata 0 \$sep]; :global time [\
:pick \$mdata (\$sep+1) \$sef]; :global prof [:pick \$mdata (\$sef+1) [:le\
n \$mdata]] ; /ip hotspot user add name=\$user password=\"\" profile=\$pro\
f server=hotspot1 limit-uptime=\$time}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=jan/01/2019 start-time=00:00:00

/ip hotspot user profile


add address-pool=dhcp_pool-hotspot name=1 on-login="{\r\
\n:local voucher \$user;\r\
\n:if ([/system scheduler find name=\$voucher]=\"\") do={/system scheduler\
\_add comment=\$voucher name=\$voucher interval=10h on-event=\"/ip hotspot\
\_active remove [find user=\$voucher]\\r\\n/ip hotspot user remove [find n\
ame=\$voucher]\\r\\n/system schedule remove [find name=\$voucher]\"}\r\
\n}" rate-limit=512K/1024K transparent-proxy=yes
add address-pool=dhcp_pool-hotspot name=3 on-login="{\r\
\n:local voucher \$user;\r\
\n:if ([/system scheduler find name=\$voucher]=\"\") do={/system scheduler\
\_add comment=\$voucher name=\$voucher interval=16h on-event=\"/ip hotspot\
\_active remove [find user=\$voucher]\\r\\n/ip hotspot user remove [find n\
ame=\$voucher]\\r\\n/system schedule remove [find name=\$voucher]\"}\r\
\n}" rate-limit=512K/1024K transparent-proxy=yes
add address-pool=dhcp_pool-hotspot name=4 on-login="{\r\
\n:local voucher \$user;\r\
\n:if ([/system scheduler find name=\$voucher]=\"\") do={/system scheduler\
\_add comment=\$voucher name=\$voucher interval=28h on-event=\"/ip hotspot\
\_active remove [find user=\$voucher]\\r\\n/ip hotspot user remove [find n\
ame=\$voucher]\\r\\n/system schedule remove [find name=\$voucher]\"}\r\
\n}" rate-limit=512K/1024K transparent-proxy=yes
add address-pool=dhcp_pool-hotspot name=5 on-login="{\r\
\n:local voucher \$user;\r\
\n:if ([/system scheduler find name=\$voucher]=\"\") do={/system scheduler\
\_add comment=\$voucher name=\$voucher interval=48h on-event=\"/ip hotspot\
\_active remove [find user=\$voucher]\\r\\n/ip hotspot user remove [find n\
ame=\$voucher]\\r\\n/system schedule remove [find name=\$voucher]\"}\r\
\n}" rate-limit=512K/1024K transparent-proxy=yes

You might also like