From 693c99f8c106e60e8097b61bbadd2b024469a808 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Wed, 14 May 2014 19:45:26 +0200 Subject: [PATCH] Script to use as cronjob for automatically commit notes files and push to master --- bin/git_autosave.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/git_autosave.sh diff --git a/bin/git_autosave.sh b/bin/git_autosave.sh new file mode 100755 index 0000000..4a40bfa --- /dev/null +++ b/bin/git_autosave.sh @@ -0,0 +1,22 @@ +#!/bin/bash +if [ -n "$1" ]; then + + FIRSTFILE=$1 + #echo $! + GITDIR=$(dirname ${FIRSTFILE}) + #echo $GITDIR + cd $GITDIR + DATETIME=`date +%Y%m%d\ %H:%M:%S` + #echo $DATETIME + #git pull + RESULT=`git commit $* -m "Autosave at $DATETIME"` + echo $RESULT + #zenity --info --text=$RESULT + #echo $? + #echo "git commit $* -m 'Autosave at $DATETIME'" + git push + +else + echo "Provide one or more file paths to autosave" + zenity --error --text="Provide one or more file paths to autosave" +fi