add gc
This commit is contained in:
parent
d07c5d407b
commit
466e35b5d1
2 changed files with 27 additions and 1 deletions
26
hcl/gc.sh
Normal file
26
hcl/gc.sh
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
# prepare workspace just in case
|
||||||
|
mkdir -p /nix/var/nix/gcroots/albatros
|
||||||
|
cd /nix/var/nix/gcroots/albatros
|
||||||
|
|
||||||
|
# remove any symlink that is older than 7 days
|
||||||
|
NOW=$(date +%s)
|
||||||
|
#EXPIRE=$((60*60*24*7)) # 7 days in seconds
|
||||||
|
EXPIRE=1700 # 7 days in seconds
|
||||||
|
|
||||||
|
for f in $(ls); do
|
||||||
|
CR=$(stat $f -c %W)
|
||||||
|
DIFF=$((NOW-CR))
|
||||||
|
if [[ $DIFF -gt $EXPIRE ]]; then
|
||||||
|
echo "deleting $f"
|
||||||
|
rm -f $f
|
||||||
|
else
|
||||||
|
echo "keeping $f";
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# we don't want to slow down the build too much, so
|
||||||
|
# we limit to 1GB of deletion
|
||||||
|
nix store gc --verbose --max 1G
|
2
main.go
2
main.go
|
@ -404,7 +404,7 @@ func initConsul() {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var err error
|
var err error
|
||||||
// init components
|
// init components.
|
||||||
initConfig()
|
initConfig()
|
||||||
initNomad()
|
initNomad()
|
||||||
initConsul()
|
initConsul()
|
||||||
|
|
Loading…
Reference in a new issue