sample of script that control a daemon

Hi everybody,
Does somebody has a sample of script that control a daemon?
for example use loop until the daemon is on and if is not on
do something else?

Thanks
Pier