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"
|
echo "→ Creating backup: $outfile"
|
||||||
|
|
||||||
tar cf - $src |
|
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
|
# Rotate: keep only the newest $max_backups
|
||||||
set files (ls -1t $dest/backup-*.tar.zst)
|
set files (ls -1t $dest/backup-*.tar.zst)
|
||||||
|
@ -28,8 +28,16 @@ pkgs.writeScript "backup-wrapper" ''
|
||||||
end
|
end
|
||||||
|
|
||||||
function periodic_backups --argument-names pid
|
function periodic_backups --argument-names pid
|
||||||
while test -d /proc/$pid
|
while true
|
||||||
sleep $interval
|
# 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)
|
echo "Interval backup at "(date)
|
||||||
backup
|
backup
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ in
|
||||||
Ryujinx = {
|
Ryujinx = {
|
||||||
name = "Ryubing w/ Backups";
|
name = "Ryubing w/ Backups";
|
||||||
comment = "Ryubing Emulator with Save 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";
|
icon = "Ryujinx";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
|
@ -52,7 +52,7 @@ in
|
||||||
citron-emu = {
|
citron-emu = {
|
||||||
name = "Citron w/ Backups";
|
name = "Citron w/ Backups";
|
||||||
comment = "Citron Emulator with Save 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";
|
icon = "applications-games";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue