Difference between revisions of "Versiebeheer van configuraties met Subversion"
| (7 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
= Geversioneerd beheer van configuraties = |
= Geversioneerd beheer van configuraties = |
||
| + | == Aanmaken configuratie directory voor server == |
||
| − | == i == |
||
| + | Voeruit vanf een werksation: |
||
| − | svn --username=martin --password=xxxxxx import /home/martin/dummy https://configurations.webhuis.nl/configurations/uwork.nl/syslog-ng/ -m "initial import syslog-ng" |
||
| + | svn --username=martin --password=xxxxxx import /home/martin/dummy \ |
||
| + | https://configurations.webhuis.nl/configurations/Webhuis.nl/syslog-ng/ -m "initial import syslog-ng" |
||
| + | Vervolgens op de server: |
||
| + | # apt-get update && apt-get install subversion |
||
| + | == script voor dagelijkse backup == |
||
| + | Voer onderstaand script op de server eenmalig uit met: |
||
| + | # /usr/local/bin/configurations <naamhost> <domein> <usersvn> <passsvn> |
||
| + | <pre> |
||
| + | #!/bin/bash |
||
| + | |||
| + | # |
||
| + | # Copyright (C) 2008 Martin Simons, Webhuis. Renkum The Netherlands |
||
| + | # |
||
| + | # This source code is licensed under the GNU General Public License, |
||
| + | # Version 2. See the file http://webhuis.nl/GPL-license for more details. |
||
| + | # |
||
| + | |||
| + | # Dagelijkse backup van de configuratie van de host naar subversion |
||
| + | |||
| + | naamhost=${1} |
||
| + | domein=${2} |
||
| + | usersvn=${3} |
||
| + | passsvn=${4} |
||
| + | |||
| + | mkdir /var/backups/${naamhost} |
||
| + | |||
| + | /usr/bin/svn checkout https://configurations.webhuis.nl/configurations/${domein}/${naamhost} \ |
||
| + | /var/backups/${naamhost} --username=${usersvn} --password=${passsvn} |
||
| + | |||
| + | cat <<eof_configuration > /usr/local/bin/${naamhost}-configuration.sh |
||
| + | #!/bin/bash |
||
| + | |||
| + | # |
||
| + | # Copyright (C) 2008 Martin Simons, Webhuis. Renkum The Netherlands |
||
| + | # |
||
| + | # This source code is licensed under the GNU General Public License, |
||
| + | # Version 2. See the file http://webhuis.nl/GPL-license for more details. |
||
| + | # |
||
| + | |||
| + | # Script voor aanmaken Samba Home directory |
||
| + | |||
| + | datum=\`date +%Y%m%d\` |
||
| + | |||
| + | cp -ur /etc /var/backups/${naamhost}/ |
||
| + | |||
| + | rm /var/backups/${naamhost}/etc/group* |
||
| + | rm /var/backups/${naamhost}/etc/gshadow |
||
| + | rm /var/backups/${naamhost}/etc/gshadow- |
||
| + | rm /var/backups/${naamhost}/etc/ldap.secret |
||
| + | rm /var/backups/${naamhost}/etc/libnss-ldap.secret |
||
| + | rm /var/backups/${naamhost}/etc/pam_ldap.secret |
||
| + | rm /var/backups/${naamhost}/etc/passwd* |
||
| + | rm /var/backups/${naamhost}/etc/shadow |
||
| + | rm /var/backups/${naamhost}/etc/shadow- |
||
| + | |||
| + | cd /var/backups/${naamhost} |
||
| + | |||
| + | /usr/bin/svn add * -q --force |
||
| + | |||
| + | /usr/bin/svn commit -m "${naamhost} \$datum" |
||
| + | |||
| + | cd - |
||
| + | |||
| + | eof_configuration |
||
| + | |||
| + | chmod +x /usr/local/bin/${naamhost}-configuration.sh |
||
| + | |||
| + | echo "zet in crontab met crontab -e " "15 3 * * * /usr/local/bin/"${naamhost}"-configuration.sh"<hr/> |
||
| + | </pre> |
||
| + | Bewaar de laatste regel vanaf 15 3 in crontab, zet het onderaan tenzij je weet wat je doet. |
||
| + | <hr/> |
||
| + | Terug naar: [[Webhuis Support Infrastructuur]] |
||
Latest revision as of 15:03, 24 July 2010
Geversioneerd beheer van configuraties
Aanmaken configuratie directory voor server
Voeruit vanf een werksation:
svn --username=martin --password=xxxxxx import /home/martin/dummy \ https://configurations.webhuis.nl/configurations/Webhuis.nl/syslog-ng/ -m "initial import syslog-ng"
Vervolgens op de server:
# apt-get update && apt-get install subversion
script voor dagelijkse backup
Voer onderstaand script op de server eenmalig uit met:
# /usr/local/bin/configurations <naamhost> <domein> <usersvn> <passsvn>
#!/bin/bash
#
# Copyright (C) 2008 Martin Simons, Webhuis. Renkum The Netherlands
#
# This source code is licensed under the GNU General Public License,
# Version 2. See the file http://webhuis.nl/GPL-license for more details.
#
# Dagelijkse backup van de configuratie van de host naar subversion
naamhost=${1}
domein=${2}
usersvn=${3}
passsvn=${4}
mkdir /var/backups/${naamhost}
/usr/bin/svn checkout https://configurations.webhuis.nl/configurations/${domein}/${naamhost} \
/var/backups/${naamhost} --username=${usersvn} --password=${passsvn}
cat <<eof_configuration > /usr/local/bin/${naamhost}-configuration.sh
#!/bin/bash
#
# Copyright (C) 2008 Martin Simons, Webhuis. Renkum The Netherlands
#
# This source code is licensed under the GNU General Public License,
# Version 2. See the file http://webhuis.nl/GPL-license for more details.
#
# Script voor aanmaken Samba Home directory
datum=\`date +%Y%m%d\`
cp -ur /etc /var/backups/${naamhost}/
rm /var/backups/${naamhost}/etc/group*
rm /var/backups/${naamhost}/etc/gshadow
rm /var/backups/${naamhost}/etc/gshadow-
rm /var/backups/${naamhost}/etc/ldap.secret
rm /var/backups/${naamhost}/etc/libnss-ldap.secret
rm /var/backups/${naamhost}/etc/pam_ldap.secret
rm /var/backups/${naamhost}/etc/passwd*
rm /var/backups/${naamhost}/etc/shadow
rm /var/backups/${naamhost}/etc/shadow-
cd /var/backups/${naamhost}
/usr/bin/svn add * -q --force
/usr/bin/svn commit -m "${naamhost} \$datum"
cd -
eof_configuration
chmod +x /usr/local/bin/${naamhost}-configuration.sh
echo "zet in crontab met crontab -e " "15 3 * * * /usr/local/bin/"${naamhost}"-configuration.sh"<hr/>
Bewaar de laatste regel vanaf 15 3 in crontab, zet het onderaan tenzij je weet wat je doet.
Terug naar: Webhuis Support Infrastructuur