SOLVED Anyone smarter than me able to get this to work? [PokemonGo-Map]

Status
Not open for further replies.

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
I tried installing this in a jail.
https://github.com/AHAAAAAAA/PokemonGo-Map

I got python, pip and the required software installed and also got it running (it looks just like it does in windows cmd when I run it.)

Problem in when I go to my jail's ip port :5000, I get a unable to connect. What am I missing?
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
I got it to work. I had to edit example.py I found the line where it gave the ip 127.0.0.1 and changed it to 0.0.0.0 and bam it worked.
Now I just need to get it auto starting.
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
OK, I was able to make a script that runs the task. I need to run it from inside the PokemonGo-map-master folder otherwise it gives errors. Anyone know how I could get this auto running? I know this is stupid, but mostly just trying to learn a little bit more.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
Right, that's how I got my script to work. But it only works properly in the Poke folder. So I'm trying to make an init script to run that script in the poke folder, but I can't get that to work right. Keeps saying -u unknown and throwing errors start is not a recognized command. It's probably something trivial, but can't seem to crack it.
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
I think I just need to edit the example.py file that starts the whole thing. It errors out can't find a file because in example.py it doesn't have the full path, hence the reason the script to start the script inside the folder...but it gave me the same error as it did when I tried to start example.py from rc.d.
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
ok so I followed everything from github, after editing the example.py file (changed 127.0.0.1 to 0.0.0.0 and it worked)

When I try to start a script outside of my poke folder (i.e. /poke/example.py) it says can not find credentials.json which is also in the poke folder. I think it's not finding it because in example.py credentials.json is relative to the folder path and not /poke/credentials.json.

I could edit the example.py and add that in, but if I can get around that cool.

So in /usr/local/etc/rc.d I have my script poke

Also, I'm sure this script could be cleaned up.

Code:
#!/bin/sh
#
#

# PROVIDE: poke
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable poke:
#
# poke_enable="YES"
#
#

. /etc/rc.subr

name=poke
rcvar=poke_enable

command=/poke/startscript.sh

load_rc_config $name
poke_enable=${poke_enable:-"NO"}


run_rc_command "$1"


and the script it goes to is this
startscript.sh

Code:
#!/bin/sh

#HOME
/usr/local/bin/python2.7 /poke/example.py -u MYUSERNAME -p MYPASSWORD -l "LOCATION" -st 10


This works on it's own but I get the credentials.json error if I run the rc.d/poke script. Originally I had the script all in the rc.d/poke but it gave me the credentials error, so this method was to try to get around that.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Try this and tell me if it works.
Ideally you wouldn't run this as root and move the files somewhere neater like /usr/local/share/PokemonGo-Map.

/usr/local/etc/rc.d/poke
Code:
#!/bin/sh
#
# PROVIDE: poke
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr
name=poke
rcvar=poke_enable
load_rc_config ${name}

: ${poke_enable:="NO"}
: ${poke_host:="127.0.0.1"}
: ${poke_port:="5000"}
: ${poke_username:="USERNAME"}
: ${poke_password:="PASSWORD"}
: ${poke_location:="LOCATION"}
: ${poke_step_limit:="10"}

poke_chdir="/poke"
command="/usr/local/bin/python2.7"
command_args="${poke_chdir}/example.py -H ${poke_host} -P ${poke_port} -u ${poke_username} -p ${poke_password} -l ${poke_location} -st ${poke_step_limit}"

run_rc_command "$1"


Then run the following, and customize your username/password/location.
Code:
chmod +x /usr/local/etc/rc.d/poke
sysrc poke_enable="YES" poke_host="0.0.0.0" poke_username="USERNAME" poke_password="PASSWORD" poke_location="LOCATION"
service poke start
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Also with the above, you don't need to modify the source for 0.0.0.0, and you don't need /poke/startscript.sh
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
ok, I did all that but now I get "env: /etc/rc.d/poke: Permission denied" when I do service poke start
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
ok, I did all that but now I get "env: /etc/rc.d/poke: Permission denied" when I do service poke start
you saved the file as /usr/local/etc/rc.d/poke right?
I just tested it and am not getting that issue.
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
yes, thats where it's installed
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
-rwxrwxrwx 1 root wheel 94 Jul 21 13:16
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
although, if I go to /etc/rc.d/poke and nano into start I see this

Code:
#!/bin/sh

. /etc/rc.subr

name=poke
rcvar=`set_rcvar`
command=/bin/bash /poke/startscript


I also have stopped using the directory /poke in favor of /usr/local/share/PokemonGo-Map-master
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
also want to confirm. in the /usr/local/etc/rc.d/poke I want to keep "${poke_username:="USERNAME"}" as is or do I put my info in there? The sysrc takes care of that correct?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
You should delete /etc/rc.d/poke
The only script you need is the one I provided which should be at /usr/local/etc/rc.d/poke
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
also want to confirm. in the /usr/local/etc/rc.d/poke I want to keep "${poke_username:="USERNAME"}" as is or do I put my info in there? The sysrc takes care of that correct?
keep it as is. use the sysrc command from earlier to change your settings. then individual settings will be saved in /etc/rc.conf
 

tstorm

Explorer
Joined
Jan 5, 2015
Messages
69
You magnificent bastard! It's working. Thanks!

Now another question. Due to limitations of this project, If I want to change locations I need to manually enter them into the location field. What do you think the best way to do this is? redo the sysrc and restart the jail?
 
Status
Not open for further replies.
Top