From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Sommer Date: Wed, 17 Sep 2003 20:25:15 +0000 Subject: Re: [SOLVED] RE: Weird environment for usb-storage script? Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org begin "Michael Hale" wrote: >>From: linux-hotplug-devel-admin@lists.sourceforge.net=20 >>[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On=20 >>Behalf Of Michael Hale >>Sent: Wednesday, September 17, 2003 1:37 PM >>To: linux-hotplug-devel@lists.sourceforge.net >>Subject: [SOLVED] RE: Weird environment for usb-storage script? >> >>I changed my usb-storage script to look like this: >>#!/bin/sh >> add here: set -e to let the script die, if something returns with an error. >>exec >/tmp/foo.$$ 2>&1 >>set -x >>invoke-rc.d ssh start >>eject >> >>echo '#!/bin/sh >>killall -9 sshd >>eject -t' > $REMOVER >> >>chmod 777 $REMOVER >> >>...and it starts and stops the ssh server. Now I just need to=20 >>read some man pages and figure out what exec and set -x are=20 >>actually doing :) But it shouldn't look so. This is only for debuging. Take a look at /tmp/foo.?? and you see what commands were executed and you see how they are called. > I am having trouble understanding what 'exec >/tmp/foo.$$ 2>&1' does. I > understand that $$ becomes my pid and that stdout and stderr are > redirected, but doesn't exec take a command? What am I missing? Also exec removes normaly the process by another. If exec is called without a command to execute, all that happens to the current process. All output of the current process (produced by set -x) is written to /tmp/foo.?? > why would my commands not run previously if they generated output on > stdout? I don't know why. This is, why you should add debugging output. J=F6rg. end. --=20 Das Recht, seine Meinung zu wechseln, ist eines der wichtigsten menschlichen Previlegien. (Robert Peel) ------------------------------------------------------- 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 Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel