diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-01-15 06:39:40 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-01-15 06:53:45 +0300 |
commit | 34cba9f52876dd1b0026c1ed6d7ab3796926c79d (patch) | |
tree | 335fc2faa0fc563e15c1a857de2e35a5f81d1bed | |
parent | 6fb9c9b9063698824c9b1d0dec1a87a087b8db16 (diff) |
nc-automount: add delays to some services in a persistent wayv1.3.6
-rw-r--r-- | bin/ncp/NETWORKING/NFS.sh | 3 | ||||
-rw-r--r-- | bin/ncp/SECURITY/fail2ban.sh | 3 | ||||
-rw-r--r-- | bin/ncp/SYSTEM/nc-automount.sh | 34 | ||||
-rw-r--r-- | bin/ncp/SYSTEM/nc-swapfile.sh | 2 | ||||
-rw-r--r-- | changelog.md | 6 |
5 files changed, 34 insertions, 14 deletions
diff --git a/bin/ncp/NETWORKING/NFS.sh b/bin/ncp/NETWORKING/NFS.sh index 24e133c2..e04cc5b7 100644 --- a/bin/ncp/NETWORKING/NFS.sh +++ b/bin/ncp/NETWORKING/NFS.sh @@ -15,9 +15,6 @@ install() apt-get install --no-install-recommends -y nfs-kernel-server systemctl disable nfs-kernel-server systemctl mask nfs-blkmap - - # delay init because of automount - sed -i 's|^ExecStartPre=.*|ExecStartPre=/bin/bash -c "/bin/sleep 30; /usr/sbin/exportfs -r"|' /lib/systemd/system/nfs-server.service } configure() diff --git a/bin/ncp/SECURITY/fail2ban.sh b/bin/ncp/SECURITY/fail2ban.sh index e58a2dac..40edec45 100644 --- a/bin/ncp/SECURITY/fail2ban.sh +++ b/bin/ncp/SECURITY/fail2ban.sh @@ -56,9 +56,6 @@ EOF grep -q actionstart_ "$F" || sed -i 's|actionstart|actionstart_|' "$F" grep -q actionstop_ "$F" || sed -i 's|actionstop|actionstop_|' "$F" - # delay init because of automount - sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" /lib/systemd/system/fail2ban.service - } configure() diff --git a/bin/ncp/SYSTEM/nc-automount.sh b/bin/ncp/SYSTEM/nc-automount.sh index fd3bde8b..89789aa9 100644 --- a/bin/ncp/SYSTEM/nc-automount.sh +++ b/bin/ncp/SYSTEM/nc-automount.sh @@ -80,10 +80,6 @@ inotifywait --monitor --event create --event delete --format '%f %e' /media/ | \ done EOF chmod +x /usr/local/etc/nc-automount-links-mon - - # delay init because of automount - sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 20" /lib/systemd/system/mariadb.service - sed -i 's|^Restart=.*|Restart=on-failure|' /lib/systemd/system/mariadb.service } configure() @@ -93,6 +89,8 @@ configure() systemctl stop nc-automount-links systemctl disable nc-automount systemctl disable nc-automount-links + rm -rf /etc/systemd/system/{mariadb,nfs-server,dphys-swapfile,fail2ban}.service.d + systemctl daemon-reload echo "automount disabled" return 0 } @@ -100,6 +98,34 @@ configure() systemctl enable nc-automount-links systemctl start nc-automount systemctl start nc-automount-links + + # create delays in some units + mkdir -p /etc/systemd/system/mariadb.service.d + cat > /etc/systemd/system/mariadb.service.d/ncp-delay-automount.conf <<'EOF' +[Service] +ExecStartPre=/bin/sleep 20 +Restart=on-failure +EOF + + mkdir -p /etc/systemd/system/nfs-server.service.d + cat > /etc/systemd/system/nfs-server.service.d/ncp-delay-automount.conf <<'EOF' +[Service] +ExecStartPre=/bin/bash -c "/bin/sleep 30; /usr/sbin/exportfs -r" +EOF + + mkdir -p /etc/systemd/system/dphys-swapfile.service.d + cat > /etc/systemd/system/dphys-swapfile.service.d/ncp-delay-automount.conf <<'EOF' +[Service] +ExecStartPre=/bin/sleep 30 +EOF + + mkdir -p /etc/systemd/system/fail2ban.service.d + cat > /etc/systemd/system/fail2ban.service.d/ncp-delay-automount.conf <<'EOF' +[Service] +ExecStartPre=/bin/sleep 10 +EOF + + systemctl daemon-reload echo "automount enabled" } diff --git a/bin/ncp/SYSTEM/nc-swapfile.sh b/bin/ncp/SYSTEM/nc-swapfile.sh index f74813f8..48f8de7c 100644 --- a/bin/ncp/SYSTEM/nc-swapfile.sh +++ b/bin/ncp/SYSTEM/nc-swapfile.sh @@ -49,8 +49,6 @@ install() { apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends dphys-swapfile - # delay init because of automount - sed -i "/\<start)/asleep 30" /etc/init.d/dphys-swapfile } diff --git a/changelog.md b/changelog.md index ba00783c..57c40ffa 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,9 @@ -[v1.3.5](https://github.com/nextcloud/nextcloudpi/commit/7697a4d) (2019-01-14) nc-hdd-test: try to detect device type if auto doesnt work +[v1.3.6](https://github.com/nextcloud/nextcloudpi/commit/fc80dc9) (2019-01-14) nc-automount: add delays to some services in a persistent way -[v1.3.4](https://github.com/nextcloud/nextcloudpi/commit/9b1ecbb) (2019-01-14) nc-info: fix automount reporting +[v1.3.5](https://github.com/nextcloud/nextcloudpi/commit/6fb9c9b) (2019-01-14) nc-hdd-test: try to detect device type if auto doesnt work + +[v1.3.4 ](https://github.com/nextcloud/nextcloudpi/commit/9b1ecbb) (2019-01-14) nc-info: fix automount reporting [v1.3.3 ](https://github.com/nextcloud/nextcloudpi/commit/389ed0c) (2019-01-14) nc-ramlog: adapt to armbian |