This should give you a start.
Problem is that when you try to get status from a user that is not found in
/ppp active, the command will fail and break the script.
To overcome this we do use
on-error that will run when user is not online and command above fails.
This gives all user status
:local status
:foreach pppuser in=[/ppp secret find ] do={
:local pppname [/ppp secret get $pppuser name]
:do {
:local tmp [/ppp active get [find where name="$pppname"]]
:set status "online"
} on-error={
:set status "offline"
}
:put "$pppname is $status"
}
If you only like to list offline users.
:foreach pppuser in=[/ppp secret find ] do={
:local pppname [/ppp secret get $pppuser name]
:do {
:local tmp [/ppp active get [find where name="$pppname"]]
} on-error={
:put $pppname
}
}
To send it to the log:
:foreach pppuser in=[/ppp secret find ] do={
:local pppname [/ppp secret get $pppuser name]
:do {
:local tmp [/ppp active get [find where name="$pppname"]]
} on-error={
:log warning "$pppname user is offline"
}
}