Adds defragment and scrub nas services

This commit is contained in:
2025-11-17 22:02:54 +01:00
parent e552750f66
commit fc734321c0
8 changed files with 52 additions and 7 deletions

View File

@@ -4,6 +4,3 @@ Description=Copies the music from Nextcloud to Navidrome
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/root/scripts/copy-music.sh ExecStart=/root/scripts/copy-music.sh
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,9 @@
[Unit]
Description=Defragments the NAS
[Service]
Type=oneshot
ExecStart=btrfs filesystem defragment -r /var/mnt/nas
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
[Unit]
Description=Timer for the defragment-nas service
[Timer]
OnCalendar=*-*-03 00:00:00
Persistent=true
Unit=defragment-nas.service
[Install]
WantedBy=timers.target

View File

@@ -16,7 +16,7 @@ RemainAfterExit=yes
# prevent the service from failing. # prevent the service from failing.
ExecStart=/usr/bin/rpm-ostree install -y --allow-inactive firewalld fail2ban fail2ban-firewalld setroubleshoot-server setools smartmontools ExecStart=/usr/bin/rpm-ostree install -y --allow-inactive firewalld fail2ban fail2ban-firewalld setroubleshoot-server setools smartmontools
ExecStart=/bin/touch /var/lib/additional-packages.stamp ExecStart=/bin/touch /var/lib/additional-packages.stamp
ExecStart=/bin/systemctl enable configure-firewalld.service enable-all-quadlets.service move-downloads-nextcloud.timer copy-music.timer ExecStart=/bin/systemctl enable configure-firewalld.service enable-all-quadlets.service move-downloads-nextcloud.timer copy-music.timer defragment-nas.timer scrub-nas.timer
ExecStart=semanage fcontext -a -t bin_t "/var/opt/bin(/.*)?" ExecStart=semanage fcontext -a -t bin_t "/var/opt/bin(/.*)?"
ExecStart=semanage fcontext -a -t bin_t "/root/scripts(/.*)?" ExecStart=semanage fcontext -a -t bin_t "/root/scripts(/.*)?"
ExecStart=restorecon -vR /var/opt/bin ExecStart=restorecon -vR /var/opt/bin

View File

@@ -4,6 +4,3 @@ Description=Move the completed torrents and jdownloader downloads to nextcloud
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/root/scripts/move-downloads-nextcloud.sh ExecStart=/root/scripts/move-downloads-nextcloud.sh
[Install]
WantedBy=multi-user.target

6
files/scrub-nas.service Normal file
View File

@@ -0,0 +1,6 @@
[Unit]
Description=Scrubs the NAS
[Service]
Type=oneshot
ExecStart=btrfs scrub start /var/mnt/nas

10
files/scrub-nas.timer Normal file
View File

@@ -0,0 +1,10 @@
[Unit]
Description=Timer for the scrub-nas service
[Timer]
OnCalendar=*-*-05 00:00:00
Persistent=true
Unit=scrub-nas.service
[Install]
WantedBy=timers.target

16
pi4.bu
View File

@@ -141,6 +141,22 @@ systemd:
enabled: false enabled: false
contents_local: files/copy-music.service contents_local: files/copy-music.service
mask: false mask: false
- name: defragment-nas.timer
enabled: false
contents_local: files/defragment-nas.timer
mask: false
- name: defragment-nas.service
enabled: false
contents_local: files/defragment-nas.service
mask: false
- name: scrub-nas.timer
enabled: false
contents_local: files/scrub-nas.timer
mask: false
- name: scrub-nas.service
enabled: false
contents_local: files/scrub-nas.service
mask: false
- name: install-additional-packages.service - name: install-additional-packages.service
enabled: true enabled: true
contents_local: files/install-additional-packages.service contents_local: files/install-additional-packages.service