Difference between revisions of "Versiebeheer van configuraties met Subversion"
(→i) |
(→script voor dagelijkse backup) |
||
Line 6: | Line 6: | ||
# apt-get update && apt-get install subversion |
# apt-get update && apt-get install subversion |
||
== script voor dagelijkse backup == |
== script voor dagelijkse backup == |
||
+ | <nowiki> |
||
+ | #!/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 |
||
+ | </nowiki> |
||
+ | chmod +x /usr/local/bin/${naamhost}-configuration.sh |
||
<hr/> |
<hr/> |
||
Terug naar: [[Uwork Support Infrastructuur]] |
Terug naar: [[Uwork Support Infrastructuur]] |
Revision as of 13:51, 5 February 2010
Geversioneerd beheer van configuraties
Aanmaken configuratie directory voor server
svn --username=martin --password=xxxxxx import /home/martin/dummy \ https://configurations.webhuis.nl/configurations/uwork.nl/syslog-ng/ -m "initial import syslog-ng"
Vervolgens op de server:
# apt-get update && apt-get install subversion
script voor dagelijkse backup
#!/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
Terug naar: Uwork Support Infrastructuur