cfgfoo

git clone https://orangeshoelaces.net/git/cfgfoo.git

ba5c549598d7b97d62fb8431f832b38224ad86ac

Author: Vasilii Kolobkov on 12/16/2018

Committer: Vasilii Kolobkov on 12/16/2018

Schedule certificate refresh with acme-client

Stats

aliases                           |  3 +-
steps/acme-client/schedcrtrefresh | 16 ++++++++
2 files changed, 18 insertions(+), 1 deletion(-)

Patch

diff --git a/aliases b/aliases
index 2dfdff4..6b71b75 100644
--- a/aliases
+++ b/aliases
@@ -1,7 +1,8 @@
 : ${CFGFOOPATH:=./cfgfoo}
 alias cfgfoo="${CFGFOOPATH}/cfgfoo"
 
-alias acmereqcrt1="cfgfoo ${CFGFOOPATH}/steps/acme-client/reqcrt1 "
+alias acme_reqcrt1="cfgfoo ${CFGFOOPATH}/steps/acme-client/reqcrt1 "
+alias acme_schedcrtrefresh="cfgfoo ${CFGFOOPATH}/steps/acme-client/schedcrtrefresh "
 
 alias addfln="cfgfoo ${CFGFOOPATH}/steps/edit/addfln "
 
diff --git a/steps/acme-client/schedcrtrefresh b/steps/acme-client/schedcrtrefresh
new file mode 100644
index 0000000..109f8a7
--- /dev/null
+++ b/steps/acme-client/schedcrtrefresh
@@ -0,0 +1,16 @@
+step_taken() {
+	crontab -l | grep -q "acme-client.\{1,\}$1"
+}
+
+# 'crontab -' is not in POSIX, nor is 'jot'
+take_step() {
+	{
+		printf '%d\t' "$(jot -r 1 0 59)"
+		printf '%d\t' "$(jot -r 1 - 23)"
+		printf '*\t'
+		printf '*\t'
+		printf '%s\t' "$(jot -r 1 1 7)"
+		printf 'root\t'
+		printf "acme-client '$1'\n"
+	} | crontab -
+}