Created
October 24, 2016 16:22
-
-
Save qknight/1fc3a8175b2ffabfc12bae772f21a142 to your computer and use it in GitHub Desktop.
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
{ config, pkgs, lib, ... } @ args: | |
#with lib; | |
let | |
stateDir = "/var/lib/crawler/"; | |
in | |
{ | |
users = { | |
users.crawler= { | |
#note this is a hack since this is not commited to the nixpkgs | |
uid = 2147483647; | |
description = "crawler server user"; | |
group = "crawler"; | |
home = stateDir; | |
createHome = true; | |
}; | |
groups.crawler= { | |
#note this is a hack since this is not commited to the nixpkgs | |
gid = 2147483648; | |
}; | |
}; | |
systemd.services.crawler= { | |
script = '' | |
${stateDir}/collect_data.py > ${stateDir}/data.json | |
''; | |
#${dbInserter} ${stateDir}/data.json | |
serviceConfig = { | |
Nice = 19; | |
IOSchedulingClass = "idle"; | |
PrivateTmp = "yes"; | |
PrivateNetwork = "yes"; | |
NoNewPrivileges = "yes"; | |
ReadOnlyDirectories = "/"; | |
ReadWriteDirectories = stateDir; | |
WorkingDirectory = stateDir; | |
}; | |
}; | |
systemd.timers.crawler = { | |
description = "crawler service"; | |
partOf = [ "crawler.service" ]; | |
wantedBy = [ "timers.target" ]; | |
timerConfig.OnCalendar = "10min"; | |
}; | |
} | |
[root@nixcloud:/etc/nixos]# systemctl list-timers --all | |
NEXT LEFT LAST PASSED UNIT ACTIVATES | |
Mon 2016-10-24 21:53:38 CEST 3h 31min left Sun 2016-10-23 21:53:38 CEST 20h ago systemd-tmpfiles-clean.timer systemd-tmpf | |
Mon 2016-10-31 00:00:00 CET 6 days left Mon 2016-10-24 00:00:03 CEST 18h ago acme-drschiele.de.timer acme-drschie | |
Mon 2016-10-31 00:00:00 CET 6 days left Mon 2016-10-24 00:00:03 CEST 18h ago acme-dune2.de.timer acme-dune2.d | |
Mon 2016-10-31 00:00:00 CET 6 days left Mon 2016-10-24 00:00:03 CEST 18h ago acme-lastlog.de.timer acme-lastlog | |
Mon 2016-10-31 00:00:00 CET 6 days left Mon 2016-10-24 00:00:03 CEST 18h ago acme-nixcloud.io.timer acme-nixclou | |
n/a n/a n/a n/a crawler.timer crawler.serv | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment