Kamis, 28 Oktober 2010

PHP win32 Service

<?php


if ($argv[1] == 'run')

{

win32_start_service_ctrl_dispatcher('dummyphp1');

while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message())

{

# do your work here.

# try not to take up more than 30 seconds before going around the loop

# again

sleep(10);

}

}


if($argv[1]=="register")

{

win32_create_service(array(

'service' => 'dummyphp1', # the name of your service

'display' => 'sample dummy PHP service #1', # description

'params' => 'd:\w32service.php run', # path to the script and parameters

));

}

else if($argv[1]=="unregister"){

win32_delete_service('dummyphp1');

}

else

{

echo "dummy Service\n";

echo "-----------------------------------\n";

echo "register - register this service \n";

echo "unregister - unregister this service \n";

echo "run - run this service \n";

}

?>

0 komentar:

Posting Komentar

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More