Automatic commit. Wed Jul 25 19:00:02 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 gnuplot="/usr/bin/gnuplot"
18 for data in $(lsof | grep interface | grep $(date +%Y) | awk '{print $NF}'); do
19         $gnuplot -e "set term png; set output \"$data.png\"; plot \"$data\" u 1:3 w lp title \"ADC4\", \"$data\" u 1:5 w lp title \"ADC5\""
20 done
21
22 $git pull # This is probably a good thing to do...
23
24 $git add update.sh
25 $git add papers
26 $git add research
27 $git add thesis/proposal/*.tex
28 $git add thesis/proposal/*.pdf
29 $git add thesis/proposal/*.bib
30 $git add thesis/*.tex
31 $git add thesis/*.pdf
32 $git add thesis/*.bib
33 $git add course/semester2
34
35 # This sets a commit message and commits. Commit will only be done if there are changed files.
36 fortune="/usr/games/fortune"
37 message=$(echo "Automatic commit. $(date)"; echo ""; $fortune; echo "")
38 $git commit -m "$message"
39 if [ "$?" == 0 ]; then
40         echo "Commit at $(date)" >> commits.log
41         $git push git.ucc 2>&1 >> commits.log
42 fi
43
44 kill -9 $SSH_AGENT_PID

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