force stop persistent php laravel artisan command from code

1k views Asked by At

I have my own custom Laravel artisan command which runs persistently. It is a command to run Twitter Streaming API using phirehose. This command won't stop unless I do CTRL+C from the CMD. How do I simulate this CTRL+C behavior from the code as well. Is there anyway I could do that in Laravel (5.1)... or PHP?

This the test code that I try

Route::get('/damned_command', function () {
    $exitCode = Artisan::call('my_own_custom_persistent_command');
});

Right now, the code won't stop. It's filling up my DB non-stop XD. The only way I could stop it right now from melting my machine is by destroying the Homestead vagrant :p

closest clue that I got: Laravel Artisan CLI safely stop daemon queue workers, but I'm still not so sure how it's gonna work

0

There are 0 answers