The Hook

| Comments

Referring to previous post, this is the post-receive script I used for the blog.

Actually I forgot to attach this to the previous post, so I decide to just create another post for this.

post-receive (post-receive) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

source /home/adie/py2/bin/activate

echo "Go to workdir"
cd /home/www/octopress
echo "Pull latest change"
sudo -u www git pull /home/git/octopress master
echo "Generate site"
sudo -u www rake generate
echo "copy site to webroot"
sudo -u www cp -R public/* ../blog
echo "Done."

The locale entries is needed by jekyll, since it’s not set at git/www user environment

Also don’t forget to add this entry to sudoers

git ALL=(www) NOPASSWD: ALL

Basically, it tells sudo to allow git to act as www without any password.

Comments