Actually, there are a couple of 'service control' UDFs in the UDF forum that use various means to control services. Just use the one that suits your needs and don't forget to read the fAQ forum on how to use UDFs.

BTW, it is normally not necessary to custom modify UDFs, though if you have improvements, the UDF writers are normally more than willing to improve the UDF in question.
_________________________
There are two types of vessels, submarines and targets.