On Fri, Apr 2, 2010 at 2:01 PM, Fred James <[email protected]>wrote:

> Denis Heidtmann wrote:
> > On Fri, Apr 2, 2010 at 12:39 PM, Denis Heidtmann
> > <[email protected]>wrote:
> >
> >
> >> On Fri, Apr 2, 2010 at 11:55 AM, Joe Pruett <[email protected]> wrote:
> >>
> >>
> >>> bash 3.2 on my system doesn't show this problem.  are you sure the full
> >>> path and relative path actually get to the same script?  could you be
> >>> accidentally running two different scripts?  or maybe it is some odd
> >>> bash bug, what version do you have?
> >>>
> >>>
> >> Since /etc/gdm/PostSession/Default is a .sh script, I must use that
> shell,
> >> also known as dash.  Maybe bash will not show the problem.  I have
> version
> >> 3.2.48(1)-release (x86_64-pc-linux-gnu).
> >>
> >> -Denis
> >>
> >> It turns  out that I jumped to an  invalid conclusion.  The issue is not
> >>
> > with bash, but with dash.   But my problem remains.  I need to use dash,
> and
> > the policy wants the script to be sourced.  My only solution at this time
> is
> > to have a separate script with the argument coded into it.  I would
> prefer
> > not to do that, but even more I would like to understand the behavior.
> >
> > -Denis
> >
> Dennis Heidtmann
> Well, first let's see if we are on the same page ... OK?
>    I run Mandriva 2008 and ...
>    (1) /bin/sh -> bash
>    (2) instead of /etc/gdm/PostSession/Default I have
> /etc/X11/gdm/PostSession/Default
>    (2.1) I have included the text of /etc/X11/gdm/PostSession/Default
> below for comparison
>    (3) if we are anywhere near on the same  page ... could you show me
> what you are trying to do?
> ... hoping to help
> Regards
> Fred James
>
> [text of /etc/X11/gdm/PostSession/Default from Mandriva 2008]
> #!/bin/sh
>
> PATH="/usr/bin:$PATH:/bin:/usr/bin"
> OLD_IFS=$IFS
>
> gdmwhich () {
>  COMMAND="$1"
>  OUTPUT=
>  IFS=:
>  for dir in $PATH
>  do
>    if test -x "$dir/$COMMAND" ; then
>      if test "x$OUTPUT" = "x" ; then
>        OUTPUT="$dir/$COMMAND"
>      fi
>    fi
>  done
>  IFS=$OLD_IFS
>  echo "$OUTPUT"
> }
>
> exit 0
>
> I want to log the time of logoff.  I was directed to
gdm/PostSession/default by:

http://people.uleth.ca/~daniel.odonnell/Blog/lost-in-logout-land-running-scripts-on-login-and-logout-partially-solved-but-interesting-anyway

Method 1: /etc/gdm/PostLogin/Default, /etc/gdm/PreSession/Default, and
/etc/gdm/PostSession/Default

"If you have a shell script that does not require user intervention, you can
run it automatically immediately after Login, immediately before the start
of the Gnome Session (i.e. before the desktop is drawn), and immediately
after your Gnome Session (i.e. after the Desktop closes down), by launching
it from /etc/gdm/PostLogin/Default, /etc/gdm/PreSession/Default, and
/etc/gdm/PostSession/Default respectively. "

I do not understand the function gdmwhich.  I just added a line executing my
script, using the fully qualified path.  The argument of the script, Logoff,
is placed in my log file, since other events get put in that file as well.
 If I source my script rather than executing it, the argument does not get
received by my script.

I am running ubuntu 9.04

This is not a huge problem.  I can create a duplicate of my script which has
Logoff hard-coded into it.  But I would like to understand why dash does not
pass the argument when the script is sourced.

Is there a way for my script to detect that it is sourced rather than
executed?

-Denis
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to