Possible to automate restart of console/terminal after 1 1/2 hours?
hi! just wanted to aski if it is possible to restart automatically the terminal or console after 1 1/2 hours? Anybody tried something like that?
Thanks!
Hi, I'm using this bash code:
#!/bin/bash while [ 1 ]; do killall java; java -jar PokemonGoBot-0.5.0.jar & sleep 5400; done
only issue you will have is on the restart, it will teleport to the start, if thats far from the end when it shut off, then it will soft ban
i use this as a auto off timer..
make a bat script to start the bot, called run.bat, use this as the timer, you need to start the bot with this script for it to work..
start "pogo" run.bat timeout /t 2400 taskkill /fi "WINDOWTITLE eq pogo_" /f taskkill /fi "WINDOWTITLE eq pogo_" /f taskkill /fi "WINDOWTITLE eq pogo*" /f
the number is seconds, 2400 = 40min
i use 3 taskkills because when i used 1 it didnt always kill it...
That's true if you are on mac and use my script you can add: "sleep 600;" after "killall java;" So you will get 10min gap before teleport back to the star;]
Thanks guys for your answers. I'm on mac and i have completely no idea, how i do it. I'm really sorry for such newbie questions. But how do i do that things? Do i have to make an extra file for that? Or just to type that things in the terminal? Thanks
Create new file "script.sh" in same directory where is jar file. Copy this lines in to that file:
#!/bin/bash while [ 1 ]; do java -jar PokemonGoBot-0.5.0.jar & sleep 5400; killall java; sleep 600; done
Make your file executable chmod +x script.sh Run your script: ./script.sh
Sorry guys, i dont get it. I wrote these exact lines in the text edit and saved it as script2.sh. I add a screenshot where you see the script file and then the terminal "output", or how you call it xD Maybe you can help me out one more time :)
thaaaanks

My solution is cron + bash script. It restarts the bot in every 2 hours.
$ crontab -l
# m h dom mon dow command
0 */2 * * * bash /home/urbalazs/bot-restart.sh
$ cat bot-restart.sh
#!/bin/bash
killall java
sleep 10
cd /home/urbalazs/PokemonGoBot
java -jar PokemonGoBot-0.5.0.jar --spring.main.web-environment=false >> log-`date +'%Y%m%d'`.txt &
The bot logs its activity to a file. It creates a new file every day, like: log-20160808.txt
This is my script. Runs between 7am and 8pm. Runs between 20 to 40 mins. Pauses 10 to 15 mins. Takes random breaks.
2 batch files -
run.bat
@echo off
setlocal enableextensions disabledelayedexpansion
TITLE pogoscrapper-controller
:loop
set "now=%time: =0%"
echo %now%
set "task=runbot"
if "%now%" geq "20:00:00,00" ( set "task=idlebot" )
if "%now%" lss "07:00:00,00" ( set "task=idlebot" )
echo Task is %task%
SET /A randvar=%RANDOM%
echo Random var - %randvar%
set thrushold=25000
if %randvar% geq %thrushold% (
echo "skipping"
goto task_idlebot
)
call :task_%task%
:task_runbot
start /min runpogo.bat
SET /A seconds=%RANDOM% * 1200 / 32768 + 1200
timeout /t %seconds%
taskkill /f /FI "WINDOWTITLE eq running-pogoscrapper" /T
:task_idlebot
SET /A seconds=%RANDOM% * 600 / 32768 + 300
timeout /t %seconds%
goto loop
runpogo.bat
TITLE running-pogoscrapper
"C:\Program Files\Java\jre1.8.0_101\bin\java.exe" -jar PokemonGoBot-0.5.0.jar
pause
pedda007, have you added last line where is word "done" ?
i added this word in this second.... now it WORKS!!!! Thank you very much! But when does the relog come? In 10 minutes? Because i waited 10min and it didn't restart...
Its will be running for 90min then pausing for 10min and restarts;]
@chemikaz how can I bring this to work when I'm using the "source" and not the prebuild on OSX? This way?
#!/bin/bash
while [ 1 ]; do
./gradlew run & sleep 5400;
killall java;
sleep 600;
done
I'm getting everything started - just wanna make sure it will work in 1,5hours ;)
I think it should work. Let me know after 1,5hr :)
@chemikaz - I'll report ;)
hi @chemikaz after 1.5 hours it not works
@zhoushifeng8 should be 10min pause before restart.
@chemikaz wait 30mins and not restart...
didn't work either ... could not kill the javaprocess with one time :/
Can someone make a video tutorial for us rookies?
urbalazs, It works great, I've simply changed the sleep time to 600 to avoid softbans.