From 19cb100786729e5d3ee3d9dddfd477c72daa9e19 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 22 Jun 2024 12:27:46 +0200 Subject: [PATCH] Keep crontab history in git --- README.md | 0 crontab_edit | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 README.md create mode 100755 crontab_edit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/crontab_edit b/crontab_edit new file mode 100755 index 0000000..7abf4f9 --- /dev/null +++ b/crontab_edit @@ -0,0 +1,21 @@ +#!/bin/sh +set -x +set -e +dir=~/.crontab +mkdir -p "$dir" +cd "$dir" +if [ ! -d .git ] +then + git init +fi +crontab -l > crontab +git add crontab +git status | grep "nothing to commit, working tree clean" || git commit +sensible-editor crontab +git add crontab +git commit +crontab crontab +if [ -n "$(git remote)" ] +then + git push -u +fi