[feature] script to prevent ssh waking up hd

This commit is contained in:
Klesh Wong 2021-02-25 23:11:48 +08:00
parent 42c67f85b5
commit 411a6b333b

View File

@ -0,0 +1,21 @@
#!/bin/sh
# reference: https://askubuntu.com/questions/282245/ssh-login-wakes-spun-down-storage-drives
[ ! -f /usr/lib/update-notifier/update-motd-fsck-at-reboot.bak ] && \
sudo cp /usr/lib/update-notifier/update-motd-fsck-at-reboot /usr/lib/update-notifier/update-motd-fsck-at-reboot.bak
awk '
$0 ~ /^now=/ {
S=1
}
S==1 && $0 ~ /NEEDS_FSCK_CHECK/ {
sub(/yes/, "")
}
{
print
}
' /usr/lib/update-notifier/update-motd-fsck-at-reboot.bak \
| sudo tee /usr/lib/update-notifier/update-motd-fsck-at-reboot >/dev/null