Skip to content

Commit

Permalink
Descriptions of variables / Easier use with Multi-Hives (RocketMap#44)
Browse files Browse the repository at this point in the history
* added descriptions of variables, and allowed for easier use with multiple hives

* Added coords-only.sh as bandaid for location-Generator.py

* updated documentation etc

* Updated for updated location_generator.py -or

* fixed README.md Link
  • Loading branch information
dirtycajunrice authored and invisiblek committed Aug 8, 2016
1 parent 245c260 commit f0c998c
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 291 deletions.
2 changes: 1 addition & 1 deletion contrib/supervisord/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Features:

## How to setup

For instructions on how to setup and run the tool, please refer to the project [wiki](https://github.com/PokemonGoMap/PokemonGo-Map/wiki/supervisord-config-files)
For instructions on how to setup and run the tool, please refer to the project [wiki](https://pgm.readthedocs.io/en/develop/extras/supervisord-on-linux.html)

## Warnings

Expand Down
60 changes: 33 additions & 27 deletions contrib/supervisord/gen-workers.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Name of coords file
# Name of coords file. If you do not have one use location_generator.py -or
coords="coords.txt"

# Webserver Location
Expand All @@ -9,36 +9,37 @@ initloc="Dallas, TX"
pre="accountname"

# Variables
worker=0
acct1=0
numacct=5
pass="yourpasshere"
auth="ptc"
st=5
sd=4
ld=1
directory='/path/to/your/runserver/directory/'
hexnum=1 # This is the beehive number you are creating. If its the first, or you want to overwrite, dont change
worker=0 # This is the worker number. Generally 0 unless 2+ Hives
acct1=0 # The beginning account number for the hive is this +1
numacct=5 # This is how many accounts you want per worker
pass="yourpasshere" # The password you used for all the accounts
auth="ptc" # The auth you use for all the accounts
st=5 # Step Count per worker
sd=5 # Scan Delay per account
ld=1 # Login Delay per account
directory='/path/to/your/runserver/directory/' # Path to the folder containing runserver.py

# Check to see if supervisor folder/subfolder exists if not make it
if [ ! -d ~/supervisor ]; then
mkdir -p supervisor/procs.d
if [ ! -d ~/supervisor/hex$hexnum ]; then
mkdir -p supervisor/hex$hexnum
fi

# Copy supervisor files to ~/supervisor
# Copy supervisor files to ~/supervisor for first install or to reset (deleting supervisord.conf)
if [ ! -f ~/supervisor/supervisord.conf ]; then
cp supervisord.conf ~/supervisor/supervisord.conf
sed -i "s,DIRECTORY,$directory," "$HOME/supervisor/supervisord.conf"
fi

if [ ! -f ~/supervisor/template.ini ]; then
cp gen-workers.sh ~/supervisor/gen-workers.sh
cp template.ini ~/supervisor/template.ini
cd "$HOME/supervisor" || exit 1
exit 0
fi

# Change Directory to ~/supervisor
cd "$HOME/supervisor" || exit 1

# Cleaning up directory
rm -f procs.d/*.ini
rm -f hex$hexnum/*.ini

# Epicly complex loop
while read -r line; do
Expand All @@ -48,21 +49,26 @@ while read -r line; do
user=$(for (( i = 1; i <= numacct; i++ )) do
echo -n "-u ACCT$i "
done)
sed -i "s/WRK/$n/" "procs.d/worker_$n.ini"
sed -i "s/LOC/$line/" "procs.d/worker_$n.ini"
sed -i "s/USER/$user/" "procs.d/worker_$n.ini"
sed -i "s/AUTH/$auth/" "procs.d/worker_$n.ini"
sed -i "s/PASS/$pass/" "procs.d/worker_$n.ini"
sed -i "s/ST/$st/" "procs.d/worker_$n.ini"
sed -i "s/LD/$ld/" "procs.d/worker_$n.ini"
sed -i "s/SD/$sd/" "procs.d/worker_$n.ini"
sed -i "s,DIRECTORY,$directory," "procs.d/worker_$n.ini"
sed -i "s/WRK/$n/" "hex$hexnum/worker_$n.ini"
sed -i "s/LOC/$line/" "hex$hexnum/worker_$n.ini"
sed -i "s/USER/$user/" "hex$hexnum/worker_$n.ini"
sed -i "s/AUTH/$auth/" "hex$hexnum/worker_$n.ini"
sed -i "s/PASS/$pass/" "hex$hexnum/worker_$n.ini"
sed -i "s/ST/$st/" "hex$hexnum/worker_$n.ini"
sed -i "s/LD/$ld/" "hex$hexnum/worker_$n.ini"
sed -i "s/SD/$sd/" "hex$hexnum/worker_$n.ini"
sed -i "s,DIRECTORY,$directory," "hex$hexnum/worker_$n.ini"
for (( i = 1; i <= numacct; i++ )) do
sed -i "s/ACCT$i/$pre$((acct1+i))/" "procs.d/worker_$n.ini"
sed -i "s/ACCT$i/$pre$((acct1+i))/" "hex$hexnum/worker_$n.ini"
done
((acct1+=numacct))
done < $coords

cp supervisord.conf ~/supervisor/supervisord.conf
sed -i "s,DIRECTORY,$directory," "$HOME/supervisor/supervisord.conf"
sed -i "s/LOC/$initloc/" "$HOME/supervisor/supervisord.conf"

# Adding the folder to supervisord.conf [inclues]
if [ -z grep -i $("hex$hexnum/\*.ini" supervisord.conf) ]; then
echo "files = hex$hexnum/*.ini" >> supervisord.conf
fi
2 changes: 1 addition & 1 deletion contrib/supervisord/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ stdout_logfile=/tmp/supervisor_webserver.log
stderr_logfile=/tmp/supervisor_webserver.log

[include]
files = procs.d/*.ini

262 changes: 0 additions & 262 deletions docs/extras/supervisord-config-files.md

This file was deleted.

Loading

0 comments on commit f0c998c

Please sign in to comment.