-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Add memory limit to duperemove service
- Loading branch information
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[Unit] | ||
Description=Btrfs deduplication on %f | ||
ConditionPathIsMountPoint=%f | ||
RequiresMountsFor=%f | ||
|
||
[Service] | ||
Type=oneshot | ||
MemoryHigh=1G | ||
ExecCondition=sh -c '[ "$(stat -f -c "%%T" "$1")" = btrfs ]' _ %f/ | ||
ExecStartPre=-find %f/ -mindepth 1 -maxdepth 1 -mtime +14 -name .duperemove.hash -exec rm -f '{}' \; | ||
ExecStartPre=-cp -a %f/.duperemove.hash duperemove.hash | ||
ExecStartPre=-compsize %f/ | ||
ExecStart=rmlint --hidden --types="duplicates" --config=sh:handler=clone %f/ | ||
ExecStart=sh -c 'exec ./rmlint.sh -d -p -r -k' | ||
ExecStart=-compsize %f/ | ||
ExecStart=-sh -c '[ "$(sqlite3 -readonly duperemove.hash "SELECT keyval FROM config where keyname=''version_major''")" -ge 4 ] || rm -f duperemove.hash' | ||
ExecStart=duperemove -r -d -h -q --hashfile=duperemove.hash --skip-zeroes --exclude="%f/.duperemove.hash" --exclude="%f/@swapfile/swapfile" %f/ | ||
ExecStartPost=-compsize %f/ | ||
ExecStopPost=-cp -a duperemove.hash %f/.duperemove.hash | ||
TimeoutStartSec=4h | ||
RuntimeDirectory=%p/%i | ||
WorkingDirectory=%t/%p/%i | ||
Nice=19 | ||
CPUSchedulingPolicy=batch | ||
IOSchedulingClass=best-effort | ||
IOSchedulingPriority=7 | ||
OOMScoreAdjust=1000 | ||
CPUWeight=30 | ||
CPUQuota=300% | ||
IOWeight=30 |
11 changes: 11 additions & 0 deletions
11
system_files/desktop/shared/usr/lib/systemd/system/btrfs-dedup@.timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Weekly Btrfs deduplication on %f | ||
|
||
[Timer] | ||
OnCalendar=weekly | ||
AccuracySec=1h | ||
RandomizedDelaySec=1d | ||
Persistent=true | ||
|
||
[Install] | ||
WantedBy=timers.target |