Code: Select all
:local dateint do={
:local montharray { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" };
:local days [ :pick $d 4 6 ];
:local month [ :pick $d 0 3 ];
:local year [ :pick $d 7 11 ];
:local monthint ([ :find $montharray $month ]);
:local month ($monthint + 1);
:if ( [len $month] = 1) do={
:local zero "0";
:return [:tonum ("$year$zero$month$days")];
} else={
:return [:tonum ("$year$month$days")];
}
};
:local timeint do={
:local hours [ :pick $t 0 2 ];
:local minutes [ :pick $t 3 5 ];
:return ($hours * 60 + $minutes);
};
:local date [ /system clock get date ];
:local time [ /system clock get time ];
:local today [$dateint d=$date] ;
:local curtime [$timeint t=$time] ;
:foreach i in [ /ppp secret find where profile="1m" ] do={
:local comment [ /ppp secret get $i comment];
:local name1 [ /ppp secret get $i name];
:local gettime [:pick $comment 12 20];
:if ([:pick $comment 3] = "/" and [:pick $comment 6] = "/") do={
:local expd [$dateint d=$comment] ;
:local expt [$timeint t=$gettime] ;
:if (($expd < $today and $expt < $curtime) or ($expd < $today and $expt > $curtime) or ($expd = $today and $expt < $curtime)) do={
/ppp secret set profile=Expired $i ;
/ppp active remove [find where name=$name1];
}
}
}