--- smeserver-affa-0.9.0/root/sbin/e-smith/affa.bug4035 2008-03-10 16:55:18.000000000 +0100 +++ smeserver-affa-0.9.0/root/sbin/e-smith/affa 2008-03-10 17:23:24.000000000 +0100 @@ -120,6 +120,7 @@ my $cwd=getcwd; chdir "/tmp"; +my $lockfile; my $defaultEmail='admin'; my $rsyncLocal = '/usr/bin/rsync'; my $rsyncRemote = '/usr/bin/rsync'; @@ -372,7 +373,6 @@ lg( "Affa $VERSION: Starting job $jobname $Command ($job{'remoteHostName'})"); lg( "Description: ".$job{'Description'} ) if defined $job{'Description'}; lg( "Bandwidth limit: $job{'BandwidthLimit'} KBytes/sec") if $job{'BandwidthLimit'}; -my $lockfile = "$lockdir/$jobname"; # check if same job already running $Command eq "scheduled" and getLock($lockfile) @@ -662,6 +662,7 @@ { dbg( " $k=$job{$k}" ) if $job{$k}; } + $lockfile = "$lockdir/$jobname"; } sub putDoneDates( $ ) @@ -1094,7 +1095,7 @@ my $WDName = "affa-watchdog-$jobname-$LocalIP"; my $trigger = Date::Format::time2str("%Y%m%d%H%M",time()+$nextScheduled); open( WD, "/usr/lib/affa/$WDName" ) or warn "Error: Couldn't open /usr/lib/affa/$WDName for writing\n"; + open( WDS, ">/tmp/$$.$WDName" ) or warn "Error: Couldn't open /tmp/$$.$WDName for writing\n"; dbg( "Watchdog parameters:" ); while( ) { @@ -1114,10 +1115,11 @@ } close( WDS ); close( WD ); - chmod( 0700, "/usr/lib/affa/$WDName" ); + chmod( 0700, "/tmp/$$.$WDName" ); my @cmd=('/usr/bin/ssh', '-o', "HostKeyAlias=$jobname", '-p', $job{'sshPort'}, $job{'remoteHostName'}, "/bin/rm", "-f", "/etc/cron.hourly/$WDName-reminder" ); not ExecCmd( @cmd, 0 ) or affaErrorExit( "Couldn't delete /etc/cron.hourly/$WDName-reminder on remote host." ); - remoteCopy("/usr/lib/affa/$WDName","/etc/cron.hourly/" ); + remoteCopy("/tmp/$$.$WDName","/etc/cron.hourly/$WDName" ); + unlink("/tmp/$$.$WDName"); } sub updateReportDB() @@ -1513,7 +1515,6 @@ sub isMounted($$) { (my $dev, my $AutomountPoint) = @_; - $dev =~ s#^([^/]*):(.*)$#\/\/$1\/$2#; # 192.168.1.1://mypc/share -> //192.168.1.1///mypc/share $AutomountPoint =~ s/\/$//; my $df = new Filesys::DiskFree; $df->df(); @@ -2466,6 +2467,7 @@ print "Job '$jobname' is running. Wait for completion. Then run affa --create-backup-file again.\n"; affaErrorExit( "affa job 'jobname' is running." ); } + setLock(); # check if archive exists checkArchiveExists($job{'RootDir'},$jobname,$archive); --- smeserver-affa-0.9.0/root/usr/lib/affa/create-backup-file.sh.bug4035 2008-03-10 17:27:45.000000000 +0100 +++ smeserver-affa-0.9.0/root/usr/lib/affa/create-backup-file.sh 2008-03-10 17:28:17.000000000 +0100 @@ -30,7 +30,10 @@ verifyint() { echo "Verify terminated by user" - rm -f $OUTFILE.md5sum $PIPE + rm -f $PIPE + if [ $OUTFILE.md5sum ] ; then + cat $OUTFILE.md5sum | sed -e s/-/$BASENAME/ > $OUTFILE.md5sum + fi exit 0 } --- smeserver-affa-0.9.0/root/usr/lib/affa/jobconfig-sample.pl.bug4035 2007-12-19 09:19:31.000000000 +0100 +++ smeserver-affa-0.9.0/root/usr/lib/affa/jobconfig-sample.pl 2008-03-10 16:55:18.000000000 +0100 @@ -40,6 +40,7 @@ 'AutomountDevice'=>'', # Device to auto mount (e.g. USB drive) 'AutomountPoint'=>'', # the mountpoint for AutomountDevice 'AutomountOptions'=>'', # Optionstring passed to mount command e.g. '-t cifs' + 'AutoUnmount'=>'yes', # umount if fs was not mounted before Affa ran 'RootDir'=>'/var/affa', # where to save the archives. Don't use /root or /home/e-smith 'Debug'=>'no', # yes | no 'status'=>'enabled', # enabled | disabled --- smeserver-affa-0.9.0/root/usr/lib/affa/jobconfig-cygwin-sample.pl.bug4035 2008-01-17 18:20:38.000000000 +0100 +++ smeserver-affa-0.9.0/root/usr/lib/affa/jobconfig-cygwin-sample.pl 2008-03-10 16:55:18.000000000 +0100 @@ -37,6 +37,7 @@ 'AutomountDevice'=>'', # Device to auto mount (e.g. USB drive) 'AutomountPoint'=>'', # the mountpoint for AutomountDevice 'AutomountOptions'=>'', # Optionstring passed to mount command e.g. '-t cifs' + 'AutoUnmount'=>'yes', # umount if fs was not mounted before Affa ran 'RootDir'=>'/var/affa', # where to save the archives. Don't use /root or /home/e-smith 'Debug'=>'no', # yes | no 'rsync--modify-window'=>0, # integer >= 0, timestamp window