Good afternoon all. I am having a little trouble with trying to backup my Apache (conf.d and httpd.conf) files to another machine via RSYNC.
Setup:-
** Both machines are running Suse 11.0 and Apache 2.2 **
Machine 1 - Main Webserver, 192.168.1.225
Machine 2 - Backup Webserver, 192.168.1.223
Machine 2 has /etc/samba/smb.conf entries:-
[apache]
comment = Apache
path = /etc/apache2
guest ok = yes
read only = no
force user = root
[htdocs]
comment = WWW Base Folder
path = /srv/www/htdocs/
guest ok = yes
read only = no
force user = badger_fruit
Machine 1 has (while logged in a local user badger_fruit) had two folders created in /home/badger_fruit/data/
apache
htdocs
In the /etc/fstab on Machine 1 I have added the entries:-
# APACHE BACKUP FOLDERS
//192.168.1.223/apache /home/badger_fruit/data/apache cifs username=root,password=##########,auto,uid=root,gid=root,_netdev 0 0
//192.168.1.223/htdocs /home/badger_fruit/data/htdocs cifs username=badger_fruit,password=##########,auto,uid=badger_fruit,gid=users,_netdev 0 0
There is a cron job set to run the script below every 1 hour:-
#!/bin/sh
LOG_FILE=/home/badger_fruit/data/backup-log
echo >> $LOG_FILE
echo "------------------------------" >> $LOG_FILE
date >> $LOG_FILE
echo "------------------------------" >> $LOG_FILE
echo "Apache Backup ==> 192.168.1.223" >> $LOG_FILE
rsync -avz /etc/apache2/httpd.conf /home/badger_fruit/data/backup/apache/ >> $LOG_FILE 2>&1
rsync -avz /etc/apache2/conf.d/* /home/badger_fruit/data/backup/apache/conf.d/ >> $LOG_FILE 2>&1
Problem:-
When I call the backup script, I see in the log file the following :-
------------------------------
Tue Aug 11 15:09:42 BST 2009
------------------------------
Apache Backup ==> 192.168.1.223
sending incremental file list
rsync: chown "/home/badger_fruit/data/backup/apache/httpd.conf" failed: Permission denied (13)
sent 38 bytes received 15 bytes 106.00 bytes/sec
total size is 8334 speedup is 157.25
rsync error: some files could not be transferred (code 23) at main.c(1031) [sender=3.0.2]
sending incremental file list
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/apache2-manual.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/badger.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/mod_perl.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/nagios.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/php5.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/phpmyadmin.conf" failed: Permission denied (13)
rsync: chown "/home/badger_fruit/data/backup/apache/conf.d/zm.conf" failed: Permission denied (13)
sent 183 bytes received 33 bytes 432.00 bytes/sec
total size is 5593 speedup is 25.89
rsync error: some files could not be transferred (code 23) at main.c(1031) [sender=3.0.2]
Can someone please help me figure out why this is failing? I would have expected it to work (but obviously not and now I am stuck!)
Many thanks for reading though the above!