linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Hale" <michaelh@cipheroptics.com>
To: linux-hotplug@vger.kernel.org
Subject: RE: [SOLVED] RE: Weird environment for usb-storage script?
Date: Wed, 17 Sep 2003 21:11:10 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-106383327914143@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-106382035329707@msgid-missing>

I added set -e and commented out exec and set -x.  My cd still ejects,
but ssh fails to start.  However when I used exec to send stdout to
/dev/null it starts ssh in addition to ejecting the cd.  Here is the
script I currently have:

#!/bin/sh

exec >/dev/null 2>&1

invoke-rc.d ssh start
eject

echo '#!/bin/sh
killall -9 sshd
eject -t' > $REMOVER
chmod 700 $REMOVER

begin  "Michael Hale" <michaelh@cipheroptics.com> wrote:
>>From: linux-hotplug-devel-admin@lists.sourceforge.net 
>>[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On 
>>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 
>>read some man pages and figure out what exec and set -x are 
>>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örg.
end.
-- 
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

      parent reply	other threads:[~2003-09-17 21:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-17 17:36 [SOLVED] RE: Weird environment for usb-storage script? Michael Hale
2003-09-17 18:19 ` Michael Hale
2003-09-17 20:25 ` Joerg Sommer
2003-09-17 21:11 ` Michael Hale [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-hotplug-106383327914143@msgid-missing \
    --to=michaelh@cipheroptics.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).