##########**********define date Format**********########### TODAYDATE="`date "+%Y%m%d%H"`" TODAYDATEFULL="`date "+%Y-%m-%d_%H:%M:%S"`"
##########**********Print The Select Menu**********########## echo
cat $SCRIPTDIR/word.txt | awk 'NR==1'
echo echo -e "\t1: backup /opt/iwgroup/" echo -e "\t2: backup /opt/iwgroup/testdir/" echo -e "\t3: backup /opt/iwgroup/dirtest" echo echo -e "Please select one from 1 to 3,or enter the path: \c" read dirpath case "$dirpath" in 1) echo -e "now start backup directory $VASOSS,be sure of this diretory is you need backup:([Y/y] or [N/n])\c" read YORN if [ "$YORN" = "Y" -o "$YORN" = "y" ] then echo "execute backup program ..." cd $VASOSS tar cvf Vasossone_vasoss_backup_$TODAYDATE.tar ./* >> $SCRIPTDIR/logs.log 2>&1 gzip Vasossone_vasoss_backup_$TODAYDATE.tar mv Vasossone_vasoss_backup_$TODAYDATE.tar.gz $BACKUPDIR echo "already backup $VASOSS directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_backup_$TODAYDATE.tar.gz" echo "at the $TODAYDATEFULL,you backup $VASOSS directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_backup_$TODAYDATE.tar.gz" >> $SCRIPTDIR/logs.log else echo "please you select again" echo "at the $TODAYDATEFULL,you ever select 1,but you canceled this operate" >> $SCRIPTDIR/logs.log fi ;; 2) echo -e "now start backup directory $VASOSSLIB,be sure of this diretory is you need backup:([Y/y] or [N/n])\c" read YORN if [ "$YORN" = "Y" -o "$YORN" = "y" ] then echo "execute backup program ..." cd $VASOSSLIB tar cvf Vasossone_vasoss_lib_backup_$TODAYDATE.tar ./* >> $SCRIPTDIR/logs.log 2>&1 gzip Vasossone_vasoss_lib_backup_$TODAYDATE.tar mv Vasossone_vasoss_lib_backup_$TODAYDATE.tar.gz $BACKUPDIR echo "already backup $VASOSSLIB directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_lib_backup_$TODAYDATE.tar.gz" echo "at the $TODAYDATEFULL,you backup $VASOSSLIB directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_lib_backup_$TODAYDATE.tar.gz" >> $SCRIPTDIR/logs.log else echo "please you select again" echo "at the $TODAYDATEFULL,you ever select 2,but you canceled this operate" >> $SCRIPTDIR/logs.log fi ;; 3) echo -e "now start backup directory $VASOSSCONF,be sure of this diretory is you need backup:([Y/y] or [N/n])\c" read YORN if [ "$YORN" = "Y" -o "$YORN" = "y" ] then echo "execute backup program ..." cd $VASOSSCONF tar cvf Vasossone_vasoss_conf_backup_$TODAYDATE.tar ./* >> $SCRIPTDIR/logs.log 2>&1 gzip Vasossone_vasoss_conf_backup_$TODAYDATE.tar mv Vasossone_vasoss_conf_backup_$TODAYDATE.tar.gz $BACKUPDIR echo "already backup $VASOSSCONF directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_conf_backup_$TODAYDATE.tar.gz" echo "at the $TODAYDATEFULL,you backup $VASOSSCONF directory to $BACKUPDIR directory,backup file name is Vasossone_vasoss_conf_backup_$TODAYDATE.tar.gz" >> $SCRIPTDIR/logs.log else echo "please you select again" echo "at the $TODAYDATEFULL,you ever select 3,but you canceled this operate" >> $SCRIPTDIR/logs.log fi ;; *) echo -e "You not select number,but you enter a path,please you be sure of this diretory exist:([Y/y] or [N/n])\c" read YORN echo $dirpath if [ "$YORN" = "Y" -o "$YORN" = "y" ] then if [ -d $dirpath ] then echo "execute backup program ..." cd $dirpath tar cvf Vasossone_other_backup_$TODAYDATE.tar ./* >> $SCRIPTDIR/logs.log 2>&1 gzip Vasossone_other_backup_$TODAYDATE.tar >> $SCRIPTDIR/logs.log 2>&1 mv Vasossone_other_backup_$TODAYDATE.tar.gz $BACKUPDIR echo "already backup $dirpath directory to $BACKUPDIR directory,backup file name is Vasossone_other_backup_$TODAYDATE.tar.gz" echo "at the $TODAYDATEFULL,you backup $dirpath directory to $BACKUPDIR directory,backup file name is Vasossone_other_backup_$TODAYDATE.tar.gz" >> $SCRIPTDIR/logs.log else echo "you enter path not exist,please check you enter and again" echo "at the $TODAYDATEFULL,you enter the path of you need backup,but this directory is not exist" >> $SCRIPTDIR/logs.log fi else echo "please you select again" echo "at the $TODAYDATEFULL,you enter the path of you need backup,but this operate be canceled by you" >> $SCRIPTDIR/logs.log fi ;; esac