Difference between revisions of "Versiebeheer van configuraties met Subversion"
(→script voor dagelijkse backup) |
(→script voor dagelijkse backup) |
||
| Line 25: | Line 25: | ||
mkdir /var/backups/${naamhost} |
mkdir /var/backups/${naamhost} |
||
| − | /usr/bin/svn checkout https://configurations.webhuis.nl/configurations/${domein}/${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 |
cat <<eof_configuration > /usr/local/bin/${naamhost}-configuration.sh |
||
Revision as of 13:53, 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
echo "zet in crontab met crontab -e " "15 3 * * * /usr/local/bin/"${naamhost}"-configuration.sh"<hr/>
Terug naar: Uwork Support Infrastructuur