Automatic commit. Wed Aug 29 20:00:05 WST 2012
[matches/honours.git] / update.sh
1 #!/bin/bash
2
3 # Script to update all the honours stuff on a regular basis
4 # Called by cron(8)
5 # Sam Moore 2012
6
7 # Need to cd to the directory, otherwise nothing will work
8 directory="/home/sam/Documents/University/honours/"
9 cd "$directory" 
10
11 # Need to do this too. Apparently
12 git="/usr/bin/git"
13 eval $(ssh-agent) 2>/dev/null
14 ssh-add /home/sam/.ssh/honours 2>/dev/null
15
16 # This bit plots any open data files, so I can remotely view them
17 # TODO: Magically update all fils
18 # TODO: Actually label plots properly, you lazy bastard
19 plot="/home/sam/Documents/University/honours/research/TCS/plot.sh"
20 for i in $(find . -name "[0-9]*.dat" -mmin -60 -size +5k -print); do 
21         $plot $i $i.png
22 done
23
24 $git pull git.ucc master # This is probably a good thing to do...
25
26 $git add update.sh
27 $git add papers
28 $git add research
29 $git add thesis/proposal/*.tex
30 $git add thesis/proposal/*.pdf
31 $git add thesis/proposal/*.bib
32 $git add thesis/*.tex
33 $git add thesis/*.pdf
34 $git add thesis/*.bib
35 #$git add course/semester2 # Don't do this; I will be putting lecture videos in this folder!
36
37 # This sets a commit message and commits. Commit will only be done if there are changed files.
38 fortune="/usr/games/fortune"
39 message=""
40 if [ "$message" == "" ]; then
41         message=$(echo "Automatic commit. $(date)"; echo ""; $fortune; echo "")
42 fi
43 $git commit -m "$message"
44 if [ "$?" == 0 ]; then
45         echo "Commit at $(date)" >> commits.log
46         $git push git.ucc 2>&1 >> commits.log
47 fi
48
49 kill -9 $SSH_AGENT_PID

UCC git Repository :: git.ucc.asn.au