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.