#!/usr/bin/bash # cd /mnt/d_e6600 fs_mounted="yes" #Checking to see if the place we want to save to is mounted. if [[ $fs_mounted ]]; then dumpFileNameHolder=("root.dump" "var.dump" "home.dump") i=0 #this line will get the date and whack it into the folder to save to folder_to_save_to=`date | awk '{print $1"_"$2"_"$3"_"$6}'` #make folder then find path and filename to save to cd ~/SIA/Backup && mkdir $folder_to_save_to && cd $folder_to_save_to #Begin the loop of checking and creating each dum for mount_point in "/" "/var" "/home" ; do size_in_1k_blocks=`df | grep "$mount_point$" | awk '{print $2}'` #we need to know what time each dump is made so we add the time the file is saved infront of the file name time_file_saved=`date | awk '{print $4}'` cd ~/SIA/Backup/$folder_to_save_to file_to_save_to="$time_file_saved.${dumpFileNameHolder[$i]}" (( i++ )) if [[ $mount_point = "/" ]]; then dump 0fBL $file_to_save_to $(( size_in_1k_blocks+100000 )) $mount_point else dump 0fB $file_to_save_to $(( size_in_1k_blocks+100000 )) $mount_point fi done fi ################################################################################# # else # WRITE A SCRIPT HERE TO EMAIL ME AND TELL ME THAT THE DUMP DIDNT HAPPEN # ################################################################################# #dump 0fB /file size /mount point exit 0