Keep crontab history in git

This commit is contained in:
Peter J. Holzer 2024-06-22 12:27:46 +02:00
commit 19cb100786
2 changed files with 21 additions and 0 deletions

0
README.md Normal file
View File

21
crontab_edit Executable file
View File

@ -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