On 29 Oct 2014, at 10:45 , Michael Nickerson <[email protected]> wrote:
> If this is a cut and paste of the script, then the problem is the first line
> - it should be USER=$1 not $USER=$1. I just tried it out and (with USER=$1)
> it worked fine for me.
>
> This is the script as I used it (slightly different than yours):
>
> - - - - - - - - - -
> #!/bin/sh
>
> USER=$1
> set > /tmp/hookEnv.txt
> _RUSER=`/usr/bin/dscl . -read /Users/$USER RealName | tail -1`
> /usr/bin/logger -t session "** USER is \"$USER\""
> /usr/bin/logger -t session "** RUser is \"$_RUSER\”"
Sadly, that was a tyop introduced by trying to make the variable names for
understandable for the post. This is the actual start of the script:
LUSER=$1
logger -t session "** LOGOUT SESSION FOR $LUSER started **"
_PS=`ps axco "lstart,comm,user" | grep loginw `
logger -t session "** _PS = $_PS"
_START_TIME=`echo $_PS | awk '{print $3, $2, $5, $4 }'`
logger -t session "** _START_TIME = $_START_TIME"
_START=`/opt/local/bin/gdate -d "$_START_TIME" "+%s"`
_END=`/opt/local/bin/gdate '+%s'`
_ELA=$((_END - _START))
_DAY=$((_ELA / 86400))
_HOU=$(((_ELA % 86400) / 3600))
_MIN=$(((_ELA % 86400 % 3600) / 60))
_RUSER=`dscl . -read /Users/$LUSER RealName | tail -1`
(the script hasn’t changed sine 10.6 or maybe 10.7)
I’ll muck about with set>/tmp/<file> though and see what’s going on.
--
Where am I going and why am I in this handbasket?
_______________________________________________
MacOSX-talk mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-talk