I have create a simple bash script for my laravel project (file name: bash-script.sh)
php artisan serv
php artisan queue:work --queue=first_queue
php artisan queue:work --queue=second_queue
php artisan queue:work --queue=third_queue
php artisan queue:work --queue=fourth_queue
php artisan schedule:work
the problem is I want each line of these commands to run in separate terminals.
Maybe this can help you, in the same terminal all processes responses:
php artisan serv &
php artisan queue:work --queue=first_queue &
php artisan queue:work --queue=second_queue &
php artisan queue:work --queue=third_queue &
php artisan queue:work --queue=fourth_queue &
php artisan schedule:work
The ampersand (&) it's for executing in another process and freeing the current execution, all outputs in every processes will write on the same terminal
Or if you do not have a graphic environment on the host (ie you connect to the remote host via ssh) you need a terminal multiplexer like screen or tmux
For both, there are several howto and example all over the web
If you want them to run in a terminal window, you will have to start a terminal window.
xterm -e "php artisan serv"&
xterm -e "php artisan queue:work --queue=first_queue"&
xterm -e "php artisan queue:work --queue=second_queue"&
# et cetera
Related
I use queues and have a jobs table in database. jobs are inserted to jobs table but when enter "php artisan queue:work --queue=something" command nothing happens. I have another project which use the same .env file and same queue and it works correctly. I have tried php artisan config:clear but it is still the same. What is the problem?
PS C:\xampp\htdocs\deneme> php artisan queue:work
PHP Warning: Module "mysqli" is already loaded in Unknown on line 0
QUEUE_DRIVER=database
use queue connection, not queue driver.
QUEUE_CONNECTION=database
Is it possible to run some other arrtisan command when we run php artisan serve . at the same time ? Is there any way to do that?
You can run multiple commands separated by a semi-colon.
For example:
php artisan view:clear; php artisan route:clear; php artisan cache:clear; php artisan config:clear
Would that help?
You need to setup supervisor on the server. It will start the queue:work for you. It can also run multiple executions of same commands.
In Laravel job given queue connection as QUEUE_CONNECTION=database. when using QUEUE_CONNECTION=sync php artisan queue:work is running but when using QUEUE_CONNECTION=database queue is not triggering. php artisan queue:listen also not triggering the job.
You need to run
php artisan queue:restart
in one tab and another tab that is running
php artisan queue:work
Please run
php artisan queue:work --queue orders
The question is straight forward, how can I run two php artisan commands at the same time?
I have two commands:
php artisan serve --host=0.0.0.0 --port=80
and
php artisan queue:work --queue=high,default
If I run them in seperated cmd windows, it works, but I would like to have them in just one cmd window.
Is this possible? I currently have this code:
#ECHO OFF
ECHO Starting DigiCoach Application
TITLE Digicoach Console application
ECHO This might take a while...
CMD /T:70 /b php artisan serve --host=0.0.0.0 --port=80
CMD /T:70 /b php artisan queue:work --queue=high,default
If you start them they will run in parralel:
Start "" php artisan serve --host=0.0.0.0 --port=80
Start "" php artisan queue:work --queue=high,default
Edit. As per #Aacini's comment the /b switch might be useful to what you require as it starts both commands without opening a new window.
Start /b "" php artisan serve --host=0.0.0.0 --port=80
Start /b "" php artisan queue:work --queue=high,default
I would however not recommend this as the output will not be what you expect. Something like calling something as simple as 2 ping commands can give an output that seems to be of an unknown language as the one commands output interferes with the others.
I have created some Command files into my Laravel Application. Laravel version is 5.2. I set command like: get:email in the Command file. Also call the Command file into Kernel.php. After that I can see the artisan command list by typing the command php artisan list. as like as below:
//output
get:email
And I changed the command title get:email to get-bq:email. When I run the command php artisan get-bq:email -- its working nicely. Also I can see the list by typing the command php artisan list::
//output
get-bq:email
Issue / Problem: Both commands are working. But I won't to work with both of them. I have done the following things:
modified command file as well as command
run composer dump-autoload -o
run composer update
remove vendor and storage folder then run composer update again.
Still the old command is working into my system.
What I want: How May I remove my old commands from my Laravel(5.2) application?
Run these commands:
php artisan cache:clear
php artisan config:clear
These commands will clear app cache and config cache and recreate it.
I've had the same problem recently.
Repoeatedly tried
php artisan cache:clear
php artisan config:clear
and the cached Kernal command wouldn't clear.
In desperation i killed the queue worker terminal and restarted the queue with the command
php artisan queue:work
The issue stopped.