Skip to contentSkip to conversation

Weird environment for usb-storage script?

DISCUSSION Michael Hale 2 participants 2 messages Sep 16, 2003 – Sep 17, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

I am having a problem with my /etc/hotplug/usb/usb-storage script. As you can see below it attempts to start the ssh server and eject the cdrom when I insert my usb drive and then stop the ssh server and any connections and unject the cdrom when I remove the drive. The cd pops in and out when I remove insert and remove the drive, but nothing happens with ssh. I have run usb-storage from the command line and it has the desired behavior, but when hotplug runs the script it doesn't start/stop ssh. Any suggestions?

#!/bin/sh

/etc/init.d/ssh start
eject

echo "#!/bin/sh" > $REMOVER
echo "/etc/init.d/ssh stop" >> $REMOVER
echo "killall -9 sshd" >> $REMOVER
echo "eject -t" >> $REMOVER
chmod 777 $REMOVER

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 10 lines · begin "Michael Hale

Hello,

I am having a problem with my /etc/hotplug/usb/usb-storage script. As you can see below it attempts to start the ssh server and eject the cdrom when I insert my usb drive and then stop the ssh server and any connections and unject the cdrom when I remove the drive. The cd pops in and out when I remove insert and remove the drive, but nothing happens with ssh. I have run usb-storage from the command line and it has the desired behavior, but when hotplug runs the script it doesn't start/stop ssh. Any suggestions?

Maybe the environment is broken.

Quoted 1 line

#!/bin/sh

exec >/tmp/foo.$$ 2>&1
set -x

Quoted 1 line

/etc/init.d/ssh start

invoke-rc.d ssh start (would be better, if your system have invoke-rc.d)

Quoted 6 lines

eject

echo "#!/bin/sh" > $REMOVER
echo "/etc/init.d/ssh stop" >> $REMOVER
echo "killall -9 sshd" >> $REMOVER
echo "eject -t" >> $REMOVER

echo '#!/bin/sh
/etc/init.d/ssh stop
killall -9 sshd
eject -t' > $REMOVER

Quoted 1 line

chmod 777 $REMOVER

Jörg.
end.

Signature · 12 lines
Man(n) sollte nie einer Frau wiedersprechen !
Man(n) sollte immer warten, bis sie es selbst erledigt.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel