[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] rsync with multiple dhcpd servers -- scripting questions



At bottom is a script I wrote to sync the files between two K12LTSP servers.  server1 is 192.168.0.254 and server2 is 192.168.0.253.

I put the script in /etc/cron.hourly.  It seems to work, except the log files are not created unless I run the script manually (as root).

I would appreciate any comments/corrections.  Thanks!


---------------------------------------------------------------------------------------------------------------------


#!/bin/bash
LOGFILE="/var/log/rsync.log"
ERRFILE="/var/log/rsync.errors"
RSYNCCMD="rsync -ahtuvz -e ssh --delete"
RSYNC="nice "$RSYNCCMD
DATE=`date`
ps aux | grep -e "$RSYNCCMD" | grep -v grep &&
  echo "We appear to be already running." &&
  sleep 2 &&
  exit -1
echo "" >>$LOGFILE
echo "***********************************************************" >>$LOGFILE
echo "rsync $DATE" >>$LOGFILE
echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" >>$LOGFILE
echo "" >>$LOGFILE
echo "" >>$ERRFILE
echo "***********************************************************" >>$ERRFILE
echo "rsync $DATE" >>$ERRFILE
echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv" >>$ERRFILE
echo "" >>$ERRFILE
#
$RSYNC server1.ltsp::home /home 1>>$LOGFILE 2>>$ERRFILE
#
$RSYNC /home/ server1.ltsp::home 1>>$LOGFILE 2>>$ERRFILE
#
$RSYNC server1.ltsp::html /var/www/html 1>>$LOGFILE 2>>$ERRFILE
#
$RSYNC /var/www/html/ server1.ltsp::html 1>>$LOGFILE 2>>$ERRFILE
#
$RSYNC server1.ltsp::'etc/passwd etc/shadow etc/group etc/gshadow etc/default/useradd etc/skel etc/login.defs etc/desktop-profiles' /etc 1>>$LOGFILE 2>>$ERRFILE
#
$RSYNC /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/default/useradd /etc/skel /etc/login.defs /etc/desktop-profiles server1.ltsp::etc 1>>$LOGFILE 2>>$ERRFILE
echo "" >>$LOGFILE
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >>$LOGFILE
echo "rsync $DATE" >>$LOGFILE
echo "***********************************************************" >>$LOGFILE
echo "" >>$ERRFILE
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >>$ERRFILE
echo "rsync $DATE" >>$ERRFILE
echo "***********************************************************" >>$ERRFILE
LOCKS='/tmp/gconfd-* /tmp/mapping-* /tmp/orbit-*'
rm -rf $LOCKS
ssh server1.ltsp rm -rf $LOCKS
exit 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]