PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

[Feature Request] Restart bot after X minutes,

Open koper89 opened this issue 10 years ago • 12 comments

Having a possiblitiy in settings to restart the bot every X minutes would be really nice. Or after Xminutes after last catched pokemon.

koper89 avatar Jul 24 '16 18:07 koper89

Why would you want to do that?

MikeDX avatar Jul 24 '16 18:07 MikeDX

To mitigate crashing risk.

koper89 avatar Jul 24 '16 18:07 koper89

If the script crashes, it has crashed and the process is ended, so it cannot restart itself.

MikeDX avatar Jul 24 '16 18:07 MikeDX

I think what he means is to mitigate the "Unknown Pokestop" loop with this feature request.

jessebinken avatar Jul 24 '16 18:07 jessebinken

I think so too, but that would be an awful way of achieving the fix if so.

MikeDX avatar Jul 24 '16 18:07 MikeDX

Ideally every bug would be solved but unpredictable crashes can still happen anytime (so far it hasn't happened to me). To solve this you could easily make an autohotkey script that checks for the process every X minutes and if the process doesn't exist, it starts it anew. EDIT: So this literally just happened to me, I was running the bot and my router dc'ed for a few minutes:

[2016-07-24 20:13:33] [#] Finished walking [2016-07-24 20:13:33] [#] Arrived at Pokestop Traceback (most recent call last): File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokecli.py", line 219 , in main() File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokecli.py", line 210 , in main bot.take_step() File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokemongo_bot__init_ _.py", line 36, in take_step self.stepper.take_step() File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokemongo_bot\stepper .py", line 61, in take_step self._work_at_position(position[0], position[1], position[2], True) File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokemongo_bot\stepper .py", line 134, in work_at_position self.bot.work_on_cell(cell, position, pokemon_only) File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokemongo_bot__init _.py", line 95, in work_on_cell hack_chain = worker.work() File "C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev\pokemongo_bot\cell_wo rkers\seen_fort_worker.py", line 31, in work if 'responses' in response_dict
TypeError: argument of type 'NoneType' is not iterable

C:\Users\XXX\Desktop\New folder\PokemonGo-Bot-dev>

Although probably nothing will be done to solve crashes, it would be a good idea to solve internet dc's.

LostDGod avatar Jul 24 '16 18:07 LostDGod

Use crontab.

*/5 * * * * timeout 5m python /home/user/bot/pokecli.py

ghost avatar Jul 24 '16 19:07 ghost

i have mine in a service in ubuntu and then restart the service every hour via cron.

Fak3Tales avatar Jul 24 '16 19:07 Fak3Tales

Yep I think I'll make cron to handle those. I think this issue can be deleted.

Regards, koper89

koper89 avatar Jul 24 '16 19:07 koper89

@koper89 i think you can mark this as closed.

Fak3Tales avatar Jul 24 '16 20:07 Fak3Tales

This command restart the bot every 1 hour, after a pause of 10 secs

while true; do timeout -k 1h -s SIGINT 1h python /home/user/bot/pokecli.py; sleep 10; done

inerba avatar Jul 25 '16 09:07 inerba

@phupabegim @inerba How i use crontab with screen to run 2 bots with an ubuntu server?

thats what i got, but i think it didnt work:

0 */2 * * * /usr/bin/screen -dmS catchthemall7fun /home/Pokemon-Go-Bot/ python pokecli.py -a ptc -u USER -p PASS --location "New York, Central Park" -m all

How can close the other screen session and let it wait 5 min to the next restart ? I didnt use the latest dev.

d-magiera avatar Jul 25 '16 09:07 d-magiera