purge jobs older than job id
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Oct 2019 12:31:07 +0000 (14:31 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 25 Oct 2019 12:31:07 +0000 (14:31 +0200)
gnt-job-purge-older-than.sh [new file with mode: 0755]

diff --git a/gnt-job-purge-older-than.sh b/gnt-job-purge-older-than.sh
new file mode 100755 (executable)
index 0000000..6a9153f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+job=$1
+
+test -z "$job" && echo "Usage: $0 job_id" && exit 1
+
+ls /var/lib/ganeti/queue/job-* | sed 's/^.*job-//'  | awk '{ if ( $1 < 3194118 ) print "/var/lib/ganeti/queue/job-"$1 }' | xargs rm -v
+
+