Add some deployment and startup scripts

They were here for ages, so let's version-control them.
This commit is contained in:
Ivan A. Melnikov 2021-09-08 12:46:40 +04:00
parent f24aa8f3f0
commit 09f9a563f0
4 changed files with 30 additions and 0 deletions

5
reporter/setup.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -exu
/usr/sbin/useradd -r -m -k /var/empty -c 'Report generator and sender' reporter

4
reporter/update.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
scp conf/basalt.json xalt:reports
rsync -yavP --exclude "*.pyc" port_stats xalt:reports/

17
stats/daily.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -ex
cd ~/stats
TAG="${1:+-$1}"
OUT_DIR="$HOME/reports/$(date '+%Y-%m-%d')$TAG"
python2 -m port_stats.daily "$OUT_DIR" basalt.json
if [ -z "$TAG" ]; then
rm -f "latest"
ln -rs "$OUT_DIR" "$HOME/reports/latest"
fi
xz "$OUT_DIR"/*/*.tsv
xz "$OUT_DIR"/*/unmets.txt

4
stats/interactive.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd ~/stats
exec python2 -im port_stats.interactive basalt.json