Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any other way to start bot on the server without using php artisan bot:start command ? #78

Open
musobekmadrimov opened this issue Oct 7, 2022 · 5 comments

Comments

@musobekmadrimov
Copy link

Is there any other way to start bot on the server without using php artisan bot:start command ?

@musobekmadrimov
Copy link
Author

I am asking this because bot stops working on server when I close the terminal. So I need make bot work without php artisan bot:start command! Thank you, beforehand!

@mepihindeveloper
Copy link

Is there any other way to start bot on the server without using php artisan bot:start command ?

As far as I understand, this can be done with a regular http request. Then the bot will work constantly

@musobekmadrimov
Copy link
Author

I had to write cron job on server to make this bot work without stopping. I checked whether bot is working or not every 10 minutes and if it is not working cron job uses command php artisan bot:start command with nohup

@mepihindeveloper
Copy link

I had to write cron job on server to make this bot work without stopping. I checked whether bot is working or not every 10 minutes and if it is not working cron job uses command php artisan bot:start command with nohup

Excellent. Can you share your experience?

@musobekmadrimov
Copy link
Author

musobekmadrimov commented Apr 22, 2023

Sure! My cron job runs this command every 10 minutes:
sh /home/fitfoodu/domains/fitfood.uz/public_html/start_up_bash.sh

In start_up_bash.sh file, these codes have been written:

pgrep -fl "php artisan bot:start"
if [[ "$?" == "0" ]] ; then
echo "working"
else
cd /home/fitfoodu/domains/fitfood.uz/public_html/;
php artisan bot:start &
fi

This code checks whether bot is working or not and if it is working writes to console "Working" what is unnecessary for us. And if the bot is not working code runs the command which enters to the project root directory and makes the bot work with the command php artisan bot:start

Easy! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants