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

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



With just a cursory glance, I would suspect that the .bash_profile ENV variables will need to be set in this script.  Whenever I would have problems like that it was usually beacuse the environment variables are not set when the script is run.  You can also put it directly into crontab and set the environment variables before you set the time for the script to run.

Millard

2008/10/12 Stephen Crampton <SteveSings gmail com>
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


_______________________________________________
K12OSN mailing list
K12OSN redhat com
https://www.redhat.com/mailman/listinfo/k12osn
For more info see <http://www.k12os.org>


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