Mon Oct 19, 2015 6:00 pm
{
:local offset 1
:global today
{
:local date [ /system clock get date ]
:local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
:local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
:local days [ :pick $date 4 6 ]
:local monthtxt [ :pick $date 0 3 ]
:local year [ :pick $date 7 11 ]
:local months ([ :find $montharray $monthtxt] )
:for nodays from=0 to=[:tonum $months] do={
:set days ( $days + [ :pick $monthdays $nodays ] )
}
:set days ($days + $year * 365)
:set today $days
}
:foreach i in [ /ip hotspot user find where profile=1000 ] do={
:if ([ :find [ /ip hotspot user get $i comment ] ] = 0 ) do={
:local date [ /ip hotspot user get $i comment ]
:local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
:local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
:local days [ :pick $date 4 6 ]
:log info ($days)
:local monthtxt [ :pick $date 0 3 ]
:log info ($monthtxt)
:local year [ :pick $date 7 11 ]
:log info ($year)
:local months ( [ :find $montharray $monthtxt ] )
:log info ($months)
:for nodays from=0 to=[:tonum $months] do={
:set days ( $days + [ :pick $monthdays $nodays ] )
}
:set days ($days + $year * 365)
:if ( ($days + $offset) < $today ) do={
:local name [/ip hotspot user get $i name]
:local mac [/ip hotspot user get $i mac-address]
:local mail [/ip hotspot user get $i email]
:local time [/system clock get time]
:local cdate [/system clock get date]
:log info "HOTSPOT EXPIRE SCRIPT: Sending email to Hotspot user $name first logged in $date"
[ /tool e-mail send to="$mail" from="5g.net" subject=("Aviso 5G Net" . " -- " . "Usoario=$name" . " -- " . "Seu Mac=$mac") body=\
"AVISO SUA RECARGA VAI VENCER !!!
Sua Recarga vai vencer nos proximos 24 Horas, use todos os Gigabytes ou Megabytes restantes imediatamente !!!
Sua Recarga atual foi ativado no Dia-$date !!!
Nome do Usoario=$name, O Mac do seu Dispositivo=$mac
Esta Mensagem foi enviado em-$cdate, Horas-$time
Muito Obrigado dos seus Amigos da 5G Net de Novo Progresso, PA, CEP 68193-000, Brasil" ]
}
}
}
}
# invalid value of "to", must be integer #
# script info th
script info HP
script info r
script info #
# now I change the profile=270RS in hotspot user #
{
:local offset 1
:global today
{
:local date [ /system clock get date ]
:local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
:local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
:local days [ :pick $date 4 6 ]
:local monthtxt [ :pick $date 0 3 ]
:local year [ :pick $date 7 11 ]
:local months ([ :find $montharray $monthtxt] )
:for nodays from=0 to=[:tonum $months] do={
:set days ( $days + [ :pick $monthdays $nodays ] )
}
:set days ($days + $year * 365)
:set today $days
}
:foreach i in [ /ip hotspot user find where profile=270RS ] do={
:if ([ :find [ /ip hotspot user get $i comment ] ] = 0 ) do={
:local date [ /ip hotspot user get $i comment ]
:local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
:local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
:local days [ :pick $date 4 6 ]
:log info ($days)
:local monthtxt [ :pick $date 0 3 ]
:log info ($monthtxt)
:local year [ :pick $date 7 11 ]
:log info ($year)
:local months ( [ :find $montharray $monthtxt ] )
:log info ($months)
:for nodays from=0 to=[:tonum $months] do={
:set days ( $days + [ :pick $monthdays $nodays ] )
}
:set days ($days + $year * 365)
:if ( ($days + $offset) < $today ) do={
:local name [/ip hotspot user get $i name]
:local mac [/ip hotspot user get $i mac-address]
:local mail [/ip hotspot user get $i email]
:local time [/system clock get time]
:local cdate [/system clock get date]
:log info "HOTSPOT EXPIRE SCRIPT: Sending email to Hotspot user $name first logged in $date"
[ /tool e-mail send to="$mail" from="5g.net" subject=("Aviso 5G Net" . " -- " . "Usoario=$name" . " -- " . "Seu Mac=$mac") body=\
"AVISO SUA RECARGA VAI VENCER !!!
Sua Recarga vai vencer nos proximos 24 Horas, use todos os Gigabytes ou Megabytes restantes imediatamente !!!
Sua Recarga atual foi ativado no Dia-$date !!!
Nome do Usoario=$name, O Mac do seu Dispositivo=$mac
Esta Mensagem foi enviado em-$cdate, Horas-$time
Muito Obrigado dos seus Amigos da 5G Net de Novo Progresso, PA, CEP 68193-000, Brasil" ]
}
}
}
}
# email send O.K, New Terminal no error,
script info 10
script info oct
script info 2015
script info 9
My email client thunderbird receifed
AVISO SUA RECARGA VAI VENCER !!!
Sua Recarga vai vencer nos proximos 24 Horas, use todos os Gigabytes ou Megabytes restantes imediatamente !!!
Sua Recarga atual foi ativado no Dia-oct/10/2015 !!!
Nome do Usoario=Sa, O Mac do seu Dispositivo=94:51:03:D3:B6:B8
Esta Mensagem foi enviado em-oct/19/2015, Horas-12:55:04
Muito Obrigado dos seus Amigos da 5G Net de Novo Progresso, PA, CEP 68193-000, Brasil #