DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-02-28 23:58:28

alpha
Member
From: Lithuania
Registered: 2008-10-06
Posts: 88

Help me with script

Hello all

I have set up ffp on USB and I'm happy with how it works, but I need one thing. I need my HHDs to be totaly unmounted when I have started from USB. Ideal sollution is unmounting automatically if USB stick with ffp is present in the system. Other way is to boot from USB and the run script which unmount HDDs. I have tried to use script for this from raidstop_patch:

Code:

#!/bin/sh

for mp in `grep "^/dev/[sm]d" /etc/mtab | awk '{ print $2 }'`; do
  if [ "$mp" ]; then
         # Try to kill all processes
         for a in 0 0 0 0 0 0 0 0 0 0; do
                 kill `fuser -m $mp` > /dev/null 2>&1
                 umount $mp > /dev/null 2>&1
                 sleep 1
                 if ! grep "$mp" /etc/mtab > /dev/null 2>&1; then a=1; break; fi
         done

         if [ $a -eq 0 ]; then
                # if killing with sigterm was unsuccessful, kill with sigkill
                for a in 0 0 0 0 0 0 0 0 0 0; do
                        kill -9 `fuser -m $mp` > /dev/null 2>&1
                        umount $mp > /dev/null 2>&1
                        sleep 1
                        if ! grep "$mp" /etc/mtab > /dev/null 2>&1; then a=1; break; fi
                done
         fi

         if [ $a -eq 0 ]; then
                 # If nothing helps, do a lazy umount
                 umount -l $mp > /dev/null 2>&1
         fi
  fi
done

This script end with message "Terminated" and HDD leds are still lit, but HD_a2 seems to be unmounted. I need totally unmount of all partitions on HDD. Can someone help me with this script or help to write another ?
I don't understand why 'fuser -m /mnt/HD_a2' command gives me output with all PID numbers available on the system if system has been started started from USB stick. Why all processes use /mnt/HD_a2 ? I don't understand. So I'll be thankful for help.

Regards,
alpha

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB