need help enable and disable pppoe

dear buddies

i am new to scripts in Mikrotik..i just wonder if someone can help me..
i want a script that runs every half hour and check if there is a pppoe client connected from the local network
if non disable the (pppoe out) on the public network then enable it immediately
if yes do nothing
and how to make it run every time the router is restarted ..

THX in advance