Код: Выделить всё
#!/bin/sh
# Enter info:
e_mail="admin@domain.kg"
backup_date="`date +%d-%m-%Y`"
# Path to command
mount="/sbin/mount"
umount="/sbin/umount"
dump="/sbin/dump"
# Path to programm
massive="/mnt/usb"
# Mount usb
${mount} /dev/sdc0 ${massive}
# Create dump slice
${dump} -0ua -L -f ${massive}/dump_root.img /dev/sda1
${dump} -0ua -L -f ${massive}/dump_usr.img /dev/sda5
${dump} -0ua -L -f ${massive}/dump_var.img /dev/sda7
# If file exists
if [ -f $massive/dump_root.img ]
then dump1="Image dump_root.img was created";
else echo "Image dump_root.img was not created, please see this dump!" | mail -s "!!ERROR Dump!!" ${e_mail}
exit 2;
fi
if [ -f $massive/dump_usr.img ]
then dump2="Image dump_usr.img was created";
else echo "Image dump_usr.img was not created, please see this dump!" | mail -s "!!ERROR Dump!!" ${e_mail}
exit 2;
fi
if [ -f $massive/dump_var.img ]
then dump3="Image dump_var.img was created";
else echo "Image dump_var.img was not created, please see this dump!" | mail -s "!!ERROR Dump!!" ${e_mail}
exit 2;
fi
# Umount usb massive
${umount} ${massive}
# Mail to me
echo "
${dump1}
${dump2}
${dump3}
" | mail -s dump_${backup_date} ${e_mail}