Home: Update backup script.
This commit is contained in:
parent
dd17839c41
commit
f4da0b24b5
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
# Check if backup drive is mounted.
|
# Check if backup drive is mounted.
|
||||||
if [ ! -f "''${path_mount}"/.mount ]; then
|
if [ ! -f "''${path_mount}"/.mount ]; then
|
||||||
report "Backup : ''${path_mount} not mounted!"
|
report "Backup: ''${path_mount} not mounted!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if hot storage is mounted.
|
# Check if hot storage is mounted.
|
||||||
if [ ! -f "''${path_src}"/.mount ]; then
|
if [ ! -f "''${path_src}"/.mount ]; then
|
||||||
report "Backup : ''${path_src} not mounted!"
|
report "Backup: ''${path_src} not mounted!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -36,22 +36,25 @@
|
||||||
cd "''${path_src}"
|
cd "''${path_src}"
|
||||||
|
|
||||||
# Save media list.
|
# Save media list.
|
||||||
find ''${path_media} -type d > ''${path_backup}/cold/ColdMedia.txt || report "Backup : Failed to save media list!"
|
find ''${path_media} -type d > ''${path_backup}/cold/ColdMedia.txt || report "Backup: Failed to save media list!"
|
||||||
cd ''${path_backup}/cold/
|
cd ''${path_backup}/cold/
|
||||||
archive ColdMedia.txt && rm ColdMedia.txt || report "Backup : Failed to archive media list!"
|
archive ColdMedia.txt && rm ColdMedia.txt || report "Backup: Failed to archive media list!"
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
# Backup data.
|
# Backup data.
|
||||||
data=$(archive data/)
|
data=$(archive data/)
|
||||||
bupsize=$(tdu ''${data} | awk '{print $1}')
|
bupsize=$(tdu ''${data} | awk '{print $1}')
|
||||||
mv ''${data} ''${path_data}/ || report "Backup : Failed to save data!"
|
mv ''${data} ''${path_data}/ || report "Backup: Failed to save data!"
|
||||||
|
|
||||||
# Backup some media.
|
# Backup some media.
|
||||||
cd ''${path_src}
|
cd ''${path_src}
|
||||||
paper=$(archive paper/)
|
paper=$(archive paper/)
|
||||||
mv ''${paper} ''${path_backup}/paper/ || report "Backup : Failed to save paper!"
|
mv ''${paper} ''${path_backup}/paper/ || report "Backup: Failed to save paper!"
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
rcp_merge_fast ''${path_src}/sync/save/ ''${path_backup}/save/tmp/ || report "Backup: Failed to save game saves!"
|
||||||
|
rcp_merge_fast ''${path_src}/sync/photo/ ''${path_backup}/photo/tmp/ || report "Backup: Failed to save photos!"
|
||||||
|
|
||||||
# Prune media copies.
|
# Prune media copies.
|
||||||
cd ''${path_backup}/paper/
|
cd ''${path_backup}/paper/
|
||||||
archive_prune Paper 7
|
archive_prune Paper 7
|
||||||
|
@ -70,8 +73,8 @@
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# Notify completion & size.
|
# Notify completion & size.
|
||||||
notify_silent "Backup : Complete ''${bupsize}."
|
notify_silent "Backup: Complete ''${bupsize}."
|
||||||
echo "Backup : Complete ''${bupsize}."
|
echo "Backup: Complete ''${bupsize}."
|
||||||
'');
|
'');
|
||||||
in {
|
in {
|
||||||
systemd.services.backup = util.mkStaticSystemdService {
|
systemd.services.backup = util.mkStaticSystemdService {
|
||||||
|
@ -88,6 +91,7 @@ in {
|
||||||
mount
|
mount
|
||||||
procps
|
procps
|
||||||
pv
|
pv
|
||||||
|
rsync
|
||||||
xz
|
xz
|
||||||
];
|
];
|
||||||
script = ''
|
script = ''
|
||||||
|
|
Loading…
Reference in a new issue