Last active
August 29, 2015 14:24
-
-
Save yuki-takei/58401ffa70c7812a9dbb to your computer and use it in GitHub Desktop.
Dynamic dav-svn configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mkdir ~/apache2 | |
$ cd ~/apache2 | |
$ git clone https://github.com/weseek/apache2conf-generator-davsvn.git | |
$ cp -r apache2conf-generator-davsvn/templates ./mytemplates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
; supervisord configuration file | |
; | |
[program:generate-davsvn-conf] | |
user=user | |
command=/bin/bash -c "while true; do /home/user/apache2/generate-davsvn-conf.sh; sleep 300; done" | |
[program:diff-and-reload-apache2] | |
command=/bin/bash -c "sleep 10; while true; do /home/user/apache2/diff-and-reload-apache2.sh; sleep 60; done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PYTHON=/usr/bin/python3.4 | |
REPOS=/home/user/repos | |
OUT=davsvn.conf | |
cd /home/user/apache2 | |
$PYTHON ./apache2conf-generator-davsvn/scan-and-gen.py --tplmap tplmap.json $REPOS > $OUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"*/rm__*": "mytemplates/empty.tpl", | |
"*": "mytemplates/with-htpasswd.tpl" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ORGCONF=/etc/apache2/conf-available/davsvn.conf | |
NEWCONF=/home/user/apache2/davsvn.conf | |
is_different=0 | |
if [ -ne ORGCONF ]; then | |
is_different=1 | |
else | |
diff $ORGCONF $NEWCONF > /dev/null 2>&1 | |
is_different=$ # set diff status | |
fi | |
# copy config file and restart apache2 | |
if [ $is_different -eq 1 ]; then | |
echo `date` "- detected changes" | |
# copy | |
cp $NEWCONF $ORGCONF | |
chown root:root $ORGCONF | |
# graceful restart | |
/usr/sbin/apachectl graceful | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment