this is for you linux guys out there :ugeek:
I've written a script for our company server that cron runs daily.
this script is as follows:
a little info:
the /media/backup_public mount is a 1TB external network drive mounted by sambafs at boot up
i tried doing this via rsync but because the drive is crap, it kept getting i/o errors and halting the backup procedure.
using the cp -u switch works for us because it only bothers the server with copying new and changed files instead of the whole system, and doesn't delete files that were deleted from the originating directory... so all that's fine and working how i want it.
now for the question:
when there are no files to be copied I get a blank email from the server. so i dont know (without checking the logs) whether or not this is because it failed or because there was nothing to copy.
can someone point me in the right direction for adding something to the script that'll tell me "X files copied" or something similar using the cp script above?
cheers :
I've written a script for our company server that cron runs daily.
this script is as follows:
Code:
#!/bin/sh
echo Subject: [BACKUP] All Company Files and Documents Backup Completeted on `date "+%d/%m/%y %l:%M %p"` > /tmp/backup-public.log
cp -vru /media/data/* /media/backup_public/ >> /tmp/backup-public.log
cat /tmp/backup-public.log | /usr/sbin/sendmail [email][email protected][/email]
rm /tmp/backup-public.log
#
a little info:
the /media/backup_public mount is a 1TB external network drive mounted by sambafs at boot up
i tried doing this via rsync but because the drive is crap, it kept getting i/o errors and halting the backup procedure.
using the cp -u switch works for us because it only bothers the server with copying new and changed files instead of the whole system, and doesn't delete files that were deleted from the originating directory... so all that's fine and working how i want it.
now for the question:
when there are no files to be copied I get a blank email from the server. so i dont know (without checking the logs) whether or not this is because it failed or because there was nothing to copy.
can someone point me in the right direction for adding something to the script that'll tell me "X files copied" or something similar using the cp script above?
cheers :