I've been working on a script to run a disk wipe (using Jim Garlick's scrub tool) on the filesystem in Xerox production printer RIPs.
Easy enough if there's just one partition, but I need to cater for the possibility of multiple drives/partitions, and either ZFS or UFS (don't know if that matters).
I can't quite figure out how to detect whether the partitions are on separate partitions (or even HDDs), and set a string/variable to trigger a second process or not.
e.g., I always want to run against the root, and typically there's a second partition with /var/spool/XRXnps mounted on it, so a second (perhaps simultaneously by backgrounding the first one) run on that (unless it's mounted on the root as well).
I hope that's clear (I'll paste my code so far below, but note ../XRXnps directory exists regardless whether under its own partition, or under the root partition).
echo "Performing scrub process on root partition..."
/usr/local/bin/scrub -f -p dod -X /junk &
# perform same routine on second partition (if it exists)
if [ -d "/var/spool/XRXnps" ]; then
echo "Performing scrub process on XRXnps partition..."
/usr/local/bin/scrub -p dod -X /var/spool/XRXnps/junk
echo "Disk scrub complete."