Saturday, 7 March 2020

Backup of file system using scripts and moving the backup file to remote server.

 #!/bin/bash
# This script is used to take backup of mount point /var and /etc

tar -cvzf /tmp/backup.tar.gz /var /tmp
find /tmp/backup.tar.gz -mtime +1 -type f -print &> /dev/null
If [ $? -eq 0 ]
        then
        echo backup completed successfully
        echo
 echo moving backup file to backup  server...
   echo .
   echo ..
   echo ...
scp /tmp/backup.tar.gz  root@192.168.1.1 x:/backup/
else
echo backup failed
echo
echo troubleshoot the script
fi

:wq!

No comments:

Post a Comment