I need to have a script that instructs the system to run an fsck on a drive but I only want it to run if the drive is not mounted "/dev/mmcblk0p2 /mnt/Share ext4 defaults 0 2"
Basically is it possible to either
- tell it to run "fsck /dev/mmcblk0p2 yes Y | command-that-asks-for-input" after the attempted mount fails
Or
- Tell it to run "fsck /dev/mmcblk0p2 (no to first question then) yes Y | command-that-asks-for-input"
Thanks so much oh great and powerful men behind the curtains. May the force be with you.
Thanks guys!
Permission denied while trying to open /dev/sda1 You must have r/w access to the filesystem or be root
– Elder Geek Jan 24 '24 at 02:25