Skip to content

Instantly share code, notes, and snippets.

@clexanis
Forked from Arano-kai/[email protected]
Last active December 17, 2024 15:21
Show Gist options
  • Select an option

  • Save clexanis/8087e3d55b0df7d19bb39a1200ec6a44 to your computer and use it in GitHub Desktop.

Select an option

Save clexanis/8087e3d55b0df7d19bb39a1200ec6a44 to your computer and use it in GitHub Desktop.

Revisions

  1. clexanis revised this gist Jan 22, 2024. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions [email protected]
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,4 @@ ProtectControlGroups=true

    # Exec
    ExecStartPre=/bin/mkdir -p ${HashDir}
    ExecStartPre=-/bin/df -h %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -h %I
    ExecStopPost=-/bin/df -h %I
  2. clexanis revised this gist Jan 22, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion [email protected]
    Original file line number Diff line number Diff line change
    @@ -35,5 +35,5 @@ ProtectControlGroups=true
    # Exec
    ExecStartPre=/bin/mkdir -p ${HashDir}
    ExecStartPre=-/bin/df -h %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -d -h $OPTIONS %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -h %I
    ExecStopPost=-/bin/df -h %I
  3. clexanis revised this gist Jan 22, 2024. 1 changed file with 39 additions and 0 deletions.
    39 changes: 39 additions & 0 deletions [email protected]
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    [Unit]
    Description=Recursive deduplication at %I
    Documentation=man:duperemove(8)
    Documentation=https://github.com/markfasheh/duperemove.git
    Conflicts=shutdown.target rescue.target rescue.service emergency.service
    After=local-fs.target
    Before=shutdown.target

    [Service]
    Type=simple
    Environment="HashDir=/var/lib/%p"
    EnvironmentFile=-/etc/default/%p

    # Ressources restriction
    MemoryHigh=75%
    MemoryAccounting=true
    Nice=19
    Restart=on-abnormal
    IOSchedulingClass=idle
    IOSchedulingPriority=7
    IOWeight=25
    CPUAccounting=true
    CPUSchedulingPolicy=batch
    CPUWeight=25
    ManagedOOMPreference=avoid

    # Security
    ProtectProc=invisible
    PrivateNetwork=true
    PrivateIPC=true
    ProtectHostname=true
    ProtectKernelTunables=true
    ProtectControlGroups=true

    # Exec
    ExecStartPre=/bin/mkdir -p ${HashDir}
    ExecStartPre=-/bin/df -h %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -d -h $OPTIONS %I
    ExecStopPost=-/bin/df -h %I
  4. clexanis revised this gist Jan 22, 2024. 1 changed file with 22 additions and 2 deletions.
    24 changes: 22 additions & 2 deletions [email protected]
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,30 @@ Before=shutdown.target
    Type=simple
    Environment="HashDir=/var/lib/%p"
    EnvironmentFile=-/etc/default/%p
    MemoryHigh=1G

    # Ressources restriction
    MemoryHigh=75%
    MemoryAccounting=true
    Nice=19
    Restart=on-abnormal
    IOSchedulingClass=idle
    IOSchedulingPriority=7
    IOWeight=25
    CPUAccounting=true
    CPUSchedulingPolicy=batch
    CPUWeight=25
    ManagedOOMPreference=avoid

    # Security
    ProtectProc=invisible
    PrivateNetwork=true
    PrivateIPC=true
    ProtectHostname=true
    ProtectKernelTunables=true
    ProtectControlGroups=true

    # Exec
    ExecStartPre=/bin/mkdir -p ${HashDir}
    ExecStartPre=-/bin/df -h %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -d -h $OPTIONS %I
    ExecStopPost=-/bin/df -h %I
    ExecStopPost=-/bin/df -h %I
  5. @Arano-kai Arano-kai renamed this gist Mar 29, 2019. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions [email protected][email protected]
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    [Unit]
    # Usage: systemctl enable --now duperemove-1w@$(systemd-escape <path>).timer
    # Usage: systemctl enable --now duperemove-weekly@$(systemd-escape <path>).timer
    # Utilize %J specifier for duration set.
    # One can hardlink/copy with '1w' part changed
    # One can hardlink/copy with 'weekly' part changed
    # to set other duration.
    Description=Deduplicate %I each %J
    Description=Deduplicate %I at calendar event (%J)
    After=local-fs.target
    Requires=local-fs.target
    Conflicts=shutdown.target rescue.target rescue.service emergency.service

    [Timer]
    Unit=duperemove@%i.service
    RandomizedDelaySec=30
    OnActiveSec=5
    OnUnitActiveSec=%J
    Persistent=true
    OnCalendar=%J

    [Install]
    WantedBy=multi-user.target
  6. @Arano-kai Arano-kai created this gist Feb 24, 2019.
    18 changes: 18 additions & 0 deletions [email protected]
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    [Unit]
    # Usage: systemctl enable --now duperemove-1w@$(systemd-escape <path>).timer
    # Utilize %J specifier for duration set.
    # One can hardlink/copy with '1w' part changed
    # to set other duration.
    Description=Deduplicate %I each %J
    After=local-fs.target
    Requires=local-fs.target
    Conflicts=shutdown.target rescue.target rescue.service emergency.service

    [Timer]
    Unit=duperemove@%i.service
    RandomizedDelaySec=30
    OnActiveSec=5
    OnUnitActiveSec=%J

    [Install]
    WantedBy=multi-user.target
    19 changes: 19 additions & 0 deletions [email protected]
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    [Unit]
    Description=Recursive deduplication at %I
    Documentation=man:duperemove(8)
    Documentation=https://github.com/markfasheh/duperemove.git
    Conflicts=shutdown.target rescue.target rescue.service emergency.service
    After=local-fs.target
    Before=shutdown.target

    [Service]
    Type=simple
    Environment="HashDir=/var/lib/%p"
    EnvironmentFile=-/etc/default/%p
    MemoryHigh=1G
    IOWeight=25
    CPUWeight=25
    ExecStartPre=/bin/mkdir -p ${HashDir}
    ExecStartPre=-/bin/df -h %I
    ExecStart=/usr/bin/duperemove --hashfile=${HashDir}/%i.hashfile -r -d -h $OPTIONS %I
    ExecStopPost=-/bin/df -h %I
    4 changes: 4 additions & 0 deletions etc-default-duperemove
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # Dir to store hash files. Each instance has own, named by $(systemd-escape <instance>).hashfile
    #HashDir=/var/lib/duperemove
    # Additional options for duperemove binary
    #OPTIONS=""