-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mkmap.sh-example that shoud be run by cron (#89)
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,11 +10,19 @@ ffmap-backend gathers information on the batman network by invoking : | |
|
||
The output will be written to a directory (`-d output`). | ||
|
||
Run `backend.py --help` for a quick overview of all available options. | ||
Copy `mkmap.sh-example` to `mkmap.sh` and adapt to your needs, test `backend.py` for example with: | ||
|
||
backend.py -d /path/to/output -a /path/to/aliases.json --vpn ae:7f:58:7d:6c:2a d2:d0:93:63:f7:da | ||
|
||
For the script's regular execution add the following to the crontab: | ||
Run `backend.py --help` for a quick overview of all available options. | ||
|
||
* * * * * backend.py -d /path/to/output -a /path/to/aliases.json --vpn ae:7f:58:7d:6c:2a --vpn d2:d0:93:63:f7:da | ||
For the script's regular execution add the following file to cron in `/etc/cron.d/ffmap-backend`: | ||
|
||
[email protected] | ||
# Freifunk Map Updates | ||
PATH=/usr/sbin:/usr/bin:/sbin:/bin | ||
* * * * * root nice -n 19 /path/to/mkmap.sh > /dev/null 2>&1 | ||
# EOF | ||
|
||
# Dependencies | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
MAXLOAD=2 # don't run when load is equal or bigger than 2.0 | ||
FFMAPPATH='/opt/ffmap-backend' | ||
TMPPATH='/tmp/ffmap-backend' | ||
TLD=ffgc | ||
|
||
if [ $(pgrep -c $(basename $0)) -gt 1 ]; then | ||
echo $(basename $0) is already running | ||
exit 0 | ||
fi | ||
|
||
load=`grep -o "^." /proc/loadavg` | ||
if [ "$load" -gt $MAXLOAD ]; then | ||
exit 1 | ||
fi | ||
|
||
mkdir -p $TMPPATH | ||
cd $FFMAPPATH | ||
cp json/nodes.json $TMPPATH/ | ||
python3 $FFMAPPATH/backend.py -d /$TMPPATH/ --aliases $FFMAPPATH/gateway.json -m bat-$TLD:/var/run/alfred.bat-$TLD.sock -p 62 --vpn de:ad:be:ef:ff:01 de:ad:be:ff:ff:02 | ||
cp /$TMPPATH/* /$FFMAPPATH/json/ | ||
|