ARGH
[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 files
18 # TODO: Actually label plots properly, you lazy bastard
19 # No longer auto plotting stuff, because I don't really check that often, and plots look better done through gnuplot than viewed as pngs
20 #plot="/home/sam/Documents/University/honours/research/TCS/plot.sh"
21 #for i in $(find . -name "[0-9]*.dat" -mmin -60 -size +5k -print); do 
22 #       $plot $i $i.png
23 #done
24
25 $git pull git.ucc master # This is probably a good thing to do...
26
27 $git add update.sh
28 $git add papers
29 $git add research
30 $git add thesis/proposal/*.tex
31 $git add thesis/proposal/*.pdf
32 $git add thesis/proposal/*.bib
33 $git add thesis/*.tex
34 $git add thesis/*.pdf
35 $git add thesis/*.bib
36 #$git add course/semester2 # Don't do this; I will be putting lecture videos in this folder!
37
38 # This sets a commit message and commits. Commit will only be done if there are changed files.
39 fortune="/usr/games/fortune"
40 message=""
41 if [ "$message" == "" ]; then
42         message=$(echo "Automatic commit. $(date)"; echo ""; $fortune; echo "")
43 fi
44 $git commit -m "$message"
45 if [ "$?" == 0 ]; then
46         echo "Commit at $(date)" >> commits.log
47         $git push git.ucc 2>&1 >> commits.log
48 fi
49
50 kill -9 $SSH_AGENT_PID

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