* Stop the queue if free disk space drops below 5 GiB.
svn path=/configurations/trunk/tud/; revision=22357
Eelco Dolstra committed
Jun 21, 2010 at 14:04 UTC
40f10681d624f19ccb53c46f88821a3633680fd7
1 file changed
+15
-2
hydra.nix
+15
-2
@@ -73,10 +73,22 @@ in
73
};
74
};
75
76
- services.cron.systemCronJobs =
77
- [ "15 02 * * * hydra source /home/hydra/.bashrc; /nix/var/nix/profiles/per-user/hydra/profile/bin/hydra_update_gc_roots.pl > /home/hydra/gc-roots.log 2>&1"
76
+ services.cron.systemCronJobs =
77
+ let
78
+ # If there is less than 5 GiB of free disk space, stop the queue
79
+ # to prevent builds from failing or aborting.
80
+ checkSpace = pkgs.writeScript "check-space"
81
+ ''
82
+ #! /bin/sh
83
+ if [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((5 * 1024**3)) ]; then
84
+ stop hydra-queue-runner
85
+ fi
86
+ '';
87
+ in
88
+ [ "15 02 * * * hydra source /home/hydrddda/.bashrc; /nix/var/nix/profiles/per-user/hydra/profile/bin/hydra_update_gc_roots.pl > /home/hydra/gc-roots.log 2>&1"
89
# Make sure that at least 200 GiB of disk space is available.
90
"15 03 * * * root nix-store --gc --max-freed \"$((200 * 1024**3 - 1024 * $(df /nix/store | tail -n 1 | awk '{ print $4 }')))\" > /var/log/gc.log 2>&1"
91
+ "*/5 * * * * root ${checkSpace}"
92
];
93
94
jobs.hydra_server =
@@ -95,6 +107,7 @@ in
107
{ name = "hydra-queue-runner";
108
startOn = "started network-interfaces";
109
exec = "${pkgs.su}/bin/su - hydra -c 'hydra_queue_runner.pl > /home/hydra/data/queue_runner.log 2>&1'";
110
+ postStop = "${pkgs.su}/bin/su - hydra -c 'hydra_queue_runner.pl --unlock'";
111
};
112
113
}