Compare commits
No commits in common. "main" and "script" have entirely different histories.
|
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
date=$(date -u +%Y-%m-%d--%H:%M)
|
|
||||||
|
|
||||||
if sudo true
|
|
||||||
then
|
|
||||||
true
|
|
||||||
else
|
|
||||||
echo 'Root privileges required'
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for drive in /dev/sd[a-z] /dev/sd[a-z][a-z] /dev/nvme[0-9]n[0-9]
|
|
||||||
do
|
|
||||||
if [[ ! -e $drive ]]; then continue ; fi
|
|
||||||
|
|
||||||
echo -n "$drive "
|
|
||||||
echo -e "\n"
|
|
||||||
|
|
||||||
smart=$(
|
|
||||||
sudo smartctl -i $drive |grep Serial
|
|
||||||
sudo smartctl -A $drive |grep -E "^ "9"" |awk -F" " '{ print $2,$10 }'
|
|
||||||
sudo smartctl -A $drive |grep -E "^ "5"" |awk -F" " '{ print $2,$10 }'
|
|
||||||
sudo smartctl -A $drive |grep -E "Current_Pending_Sector" |awk -F" " '{ print $2,$10 }'
|
|
||||||
sudo smartctl -A $drive |grep -E "Offline_Uncorrectable" |awk -F" " '{ print $2,$10 }'
|
|
||||||
)
|
|
||||||
|
|
||||||
echo -e "$smart\n" >> /var/log/smart-check/smart-check$date.log
|
|
||||||
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=S.M.A.R.T Monitor script
|
|
||||||
Wants=smartmonitor.timer
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/bin/bash /root/smart-check.sh
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=S.M.A.R.T script timer
|
|
||||||
Requires=smartmonitor.service
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=15min
|
|
||||||
OnUnitActiveSec=24h
|
|
||||||
Unit=smartmonitor.service
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
Loading…
Reference in New Issue