ma arafetch: add extra logic for remote stats generation

This commit is contained in:
makefu 2018-04-04 14:46:15 +02:00
parent fc3a10ebec
commit d1542ef773
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225

View File

@ -3,7 +3,7 @@ with import <stockholm/lib>;
let let
pkg = with pkgs.python3Packages;buildPythonPackage rec { pkg = with pkgs.python3Packages;buildPythonPackage rec {
rev = "762d747"; rev = "762d747";
name = "europastats-${rev}"; name = "arafetch-${rev}";
propagatedBuildInputs = [ propagatedBuildInputs = [
requests requests
docopt docopt
@ -25,12 +25,25 @@ in {
}; };
systemd.services.arafetch = { systemd.services.arafetch = {
startAt = "Mon 09:15:00"; startAt = "Mon,Wed,Fri 09:15:00";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = { environment = {
OUTDIR = home; OUTDIR = home;
}; };
path = [ pkg pkgs.git pkgs.wget ]; path = [ pkg pkgs.git pkgs.wget ];
script = "${pkg}/bin/weekrun"; serviceConfig = {
User = "arafetch";
WorkingDirectory = home;
PrivateTmp = true;
ExecStart = pkgs.writeDash "start-weekrun" ''
set -x
weekrun || echo "weekrun failed!"
find $OUTDIR/db -name \*.json | while read path;do
file=''${path##*/}
cantine=''${file%%.json}
ara2influx $path --cantine $cantine --host wbob.r
done
'';
};
}; };
} }