Long ago, I decided that inconvenient fsck's were not what I
needed. And that cancelling them was not an option - I run quasi
headless so there's no way.
So - I use tune2fs to set a ridiculous reboot count for automatic
fsck. Then a run a cron job the does a reboot with the -F option once
a month in the middle of the night when I don't need the machine.
systemd won't change a thing for me.
cron job follows. it actually checks for a disk that needs an fsck.
#!/bin/bash
#check for fsck needed and force it and reboot if needed
[ "$1" = -force ] && force=yes
month=$(date +%b)
reboot=no
while read disk rest
do
lastfsck=$(tune2fs -l $disk | grep 'Last checked:')
lastfsck=${lastfsck:30:3}
[ "$lastfsck" = "$month" ] || reboot=yes
done << --end
$(df | egrep '^/dev')
--end
if [ "$force" != yes ]
then
[ $reboot = no ] && exit
if [ -n "$(who)" ]
then
echo 'Not rebooting because of logged on users'
who
exit
fi
fi
echo 'checkfsck rebooting' | mail -s checkfsck root
# -F below forces check of all filesystems, not just root
echo 'checkfsck rebooting'
shutdown -rF now
sleep 120
echo 'shutdown seems to be broken again'
shutdown -nrF now
sleep 120
echo 'shutdown -n seems to have failed'
sleep 120
touch /forcefsck
sync;sync;sync;sleep 60;reboot -f
sleep 120
echo 'it just wont die - need help'
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: https://lists.debian.org/[email protected]