Issue
I have two websites using the Laravel framework. I need to use a command to process queues. For that I use nohup.
However I need to run two identical nohup commands to make it run in the background for the two different websites. The problem is that sometimes I need to stop only one command for maintenance. How do I identify which nohup command belongs to a particular website ? Can I use a name identifier in the nohup command ?
Solution
You could use php's -E
cli argument, which lets you specify code to execute "after" the rest of the script completes, and this extra code could be just a PHP comment, allowing you to embed ID information:
sudo nohup php -E '//job #x' artisan etc...
^^^^^^^^---raw php code, no <?..?> required
Since it's just a comment, it won't actually DO anything, and you can format the comment to contain whatever ID information you want.
Answered By - Marc B