1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?php namespace jobs; use jobd\exceptions\JobInterruptedException; class LongRunningTask extends \Job { public function run() { set_time_limit(0); sleep(120); echo 'ok'; } public function signalHandler(int $signal) { if ($signal == 15) { throw new JobInterruptedException(0, 'i\'m exiting gracefully'); } } }