Optimizes backup script for switch emulators
• Fixes parameter error from compression tool command • Implements incremental sleep in periodic backups for faster process exit detection • Increases backup count for emulator configurations from 20 to 30
This commit is contained in:
parent
3439a9c8ba
commit
5ad86d90df
2 changed files with 13 additions and 5 deletions
|
@ -15,7 +15,7 @@ pkgs.writeScript "backup-wrapper" ''
|
|||
echo "→ Creating backup: $outfile"
|
||||
|
||||
tar cf - $src |
|
||||
${pkgs.zstd}/bin/zstd -- -c -T5 -15 -v > $outfile
|
||||
${pkgs.zstd}/bin/zstd -c -T5 -15 -v > $outfile
|
||||
|
||||
# Rotate: keep only the newest $max_backups
|
||||
set files (ls -1t $dest/backup-*.tar.zst)
|
||||
|
@ -28,8 +28,16 @@ pkgs.writeScript "backup-wrapper" ''
|
|||
end
|
||||
|
||||
function periodic_backups --argument-names pid
|
||||
while test -d /proc/$pid
|
||||
sleep $interval
|
||||
while true
|
||||
# sleep in 1s increments so we can detect process exit early
|
||||
for i in (seq 1 $interval)
|
||||
if not test -d /proc/$pid
|
||||
return
|
||||
end
|
||||
sleep 1
|
||||
end
|
||||
|
||||
# If we're still here, do the interval backup
|
||||
echo "Interval backup at "(date)
|
||||
backup
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ in
|
|||
Ryujinx = {
|
||||
name = "Ryubing w/ Backups";
|
||||
comment = "Ryubing Emulator with Save Backups";
|
||||
exec = ''fish ${backup-wrapper} /home/${user}/.config/Ryujinx/bis/user/save /pool/Backups/Switch/RyubingSaves 960 20 -- ryujinx''; # Should amount to be ~8 hours of playtime in 30 backups
|
||||
exec = ''fish ${backup-wrapper} /home/${user}/.config/Ryujinx/bis/user/save /pool/Backups/Switch/RyubingSaves 960 30 -- ryujinx''; # Should amount to be ~8 hours of playtime in 30 backups
|
||||
icon = "Ryujinx";
|
||||
type = "Application";
|
||||
terminal = false;
|
||||
|
@ -52,7 +52,7 @@ in
|
|||
citron-emu = {
|
||||
name = "Citron w/ Backups";
|
||||
comment = "Citron Emulator with Save Backups";
|
||||
exec = ''fish ${backup-wrapper} /home/${user}/.local/share/citron/nand/user/save /pool/Backups/Switch/CitronSaves 960 20 -- citron-emu''; # Should amount to be ~8 hours of playtime in 30 backups
|
||||
exec = ''fish ${backup-wrapper} /home/${user}/.local/share/citron/nand/user/save /pool/Backups/Switch/CitronSaves 960 30 -- citron-emu''; # Should amount to be ~8 hours of playtime in 30 backups
|
||||
icon = "applications-games";
|
||||
type = "Application";
|
||||
terminal = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue