mirror of
https://github.com/Facundo-prog/automatic_backup_script.git
synced 2025-07-06 19:12:28 +00:00
updated
This commit is contained in:
parent
6dc0082b3d
commit
02a01b0ccb
17
README.md
17
README.md
@ -22,6 +22,9 @@ Edit the mount points file:
|
||||
|
||||
|
||||
Replace the disk `UUID` and `mount point` (default is "/backup-disk") with your configuration:
|
||||
|
||||
View fstab file for more information.
|
||||
|
||||
```
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
|
||||
@ -32,6 +35,10 @@ UUID=645648-kadfvadfb86teyn1sd3 /boot/efi vfat umask=0077 0
|
||||
UUID=<replace for your disk UUID> /<replace for moun point> ext4 defaults 0 0
|
||||
```
|
||||
|
||||
Reload system dameon:
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
|
||||
### Modify custom service:
|
||||
|
||||
@ -62,10 +69,6 @@ Copy script:
|
||||
|
||||
sudo cp backup-files.service /etc/systemd/system/
|
||||
|
||||
Reload system dameon:
|
||||
|
||||
sudo systemctl dameon-reload
|
||||
|
||||
Enable backup service:
|
||||
|
||||
sudo systemctl enable backup-files.service
|
||||
@ -122,7 +125,7 @@ Start service:
|
||||
</br>
|
||||
|
||||
|
||||
## View backup files
|
||||
## View Backup Files
|
||||
|
||||
### If the backup disk is different from the installation disk:
|
||||
|
||||
@ -130,7 +133,7 @@ Show disks:
|
||||
|
||||
sudo lsblk
|
||||
|
||||
Mount external disk. Command example contain disñ /dev/sdb1 and a mount point is "/backup-files":
|
||||
Mount the external disk. An example command contains disk /dev/sdb1 and a mount point is "/backup-files":
|
||||
|
||||
sudo mount /dev/sdb1 /backup-files
|
||||
|
||||
@ -138,6 +141,6 @@ Mount external disk. Command example contain disñ /dev/sdb1 and a mount point i
|
||||
|
||||
### Or if the backup disk is the installation disk:
|
||||
|
||||
Enter in folder cofigured of script backup-files.sh:
|
||||
Enter the folder configured for the script backup-files.sh:
|
||||
|
||||
cd /backup-files
|
||||
|
@ -24,22 +24,6 @@ perform_backup() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ external_disk ]; then
|
||||
|
||||
# The mount point disk not exists
|
||||
if [ ! -d "$backup_path" ]; then
|
||||
mkdir -p "$backup_path"
|
||||
echo "Mount point disk created"
|
||||
fi
|
||||
|
||||
# The disk not mount
|
||||
if ! mountpoint -q "$backup_path"; then
|
||||
echo "Mounting disk..."
|
||||
mount "$backup_path"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# The destination folder not exists
|
||||
if [ ! -d "$destination" ]; then
|
||||
echo "Folder $destination created"
|
||||
@ -60,6 +44,22 @@ perform_backup() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Check if the mount point exists and disk is mounted
|
||||
if [ external_disk ]; then
|
||||
# The mount point disk not exists
|
||||
if [ ! -d "$backup_path" ]; then
|
||||
mkdir -p "$backup_path"
|
||||
echo "Mount point disk created"
|
||||
fi
|
||||
|
||||
# The disk not mount
|
||||
if ! mountpoint -q "$backup_path"; then
|
||||
echo "Mounting disk..."
|
||||
mount "$backup_path"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Iterate over origin-destination pairs and perform backup
|
||||
for (( i=0; i<${#origins[@]}; i++ )); do
|
||||
perform_backup "${origins[i]}" "${destinations[i]}"
|
||||
|
4
fstab
4
fstab
@ -10,7 +10,7 @@
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
|
||||
# Others discks
|
||||
UUID= /boot/efi vfat umask=0077 0 1
|
||||
UUID=645648-kadfvadfb86teyn1sd3 /boot/efi vfat umask=0077 0 1
|
||||
|
||||
# backup external disk
|
||||
UUID= /backup-disk ext4 defaults 0 0
|
||||
UUID=45afds53g /backup-disk ext4 defaults 0 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user