From owner-freebsd-gnome@FreeBSD.ORG Tue Jun 10 08:27:41 2003 Return-Path: Delivered-To: freebsd-gnome@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F300A37B401 for ; Tue, 10 Jun 2003 08:27:40 -0700 (PDT) Received: from symbion.srrc.usda.gov (symbion.srrc.usda.gov [199.133.86.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id D36D943FB1 for ; Tue, 10 Jun 2003 08:27:38 -0700 (PDT) (envelope-from gjohnson@srrc.ars.usda.gov) Received: from node1.cluster.srrc.usda.gov (localhost [127.0.0.1]) by symbion.srrc.usda.gov (8.12.9/8.12.9) with ESMTP id h5AFRaBm073002 for ; Tue, 10 Jun 2003 10:27:36 -0500 (CDT) (envelope-from glenn@node1.cluster.srrc.usda.gov) Received: (from glenn@localhost)h5AFRZH1073001 for gnome@freebsd.org; Tue, 10 Jun 2003 10:27:35 -0500 (CDT) (envelope-from glenn) Date: Tue, 10 Jun 2003 10:27:35 -0500 From: Glenn Johnson To: gnome@freebsd.org Message-ID: <20030610152735.GA71845@node1.cluster.srrc.usda.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: reading passwd file with gdm X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jun 2003 15:27:41 -0000 I am trying to parse the master.passwd file during gdm logins to see if the passwd has reached its expiration time. The following command works on the command line and in a simple sh script that I tested: CHANGE=`perl -e "print join(':', getpwnam ('$USER'));" | awk -F: '{print $5}'` However, it does not work when put into gdm/PreSession/Default. Here is my PreSession/Default file. I put in an echo command to see the values. --begin gdm/PreSession/Default-- #!/bin/sh # # Note that any setup should come before the sessreg command as # that must be 'exec'ed for the pid to be correct (sessreg uses the parent # pid) # # Note that output goes into the .xsession-errors file for easy debugging # PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xrdb /etc/X11/Xresources xmessage -nearmouse -file /etc/motd -default okay if /usr/bin/which -s xsetroot > /dev/null 2>&1; then xsetroot -cursor_name left_ptr -solid "#363047" fi TIME=`date +%s` CHANGE=`perl -e "print join(':', getpwnam ('$USER'));" | awk -F: '{print $5}'` echo TIME is $TIME CHANGE is $CHANGE EXPIRED is $EXPIRED > ~/aging if [ "$EXPIRED" = "yes" ]; then xterm -e passwd fi if /usr/bin/which -s sessreg > /dev/null 2>&1; then # some output for easy debugging echo "$0: Registering your session with wtmp and utmp" echo "$0: running: sessreg -a -w /var/log/wtmp -u /var/run/utmp -x \"$X_SERVERS\" -h \"$REMOTE_HOST\" -l $DISPLAY $USER" exec sessreg -a -w /var/log/wtmp -u /var/run/utmp -x "$X_SERVERS" -h "$REMOTE_HOST" -l $DISPLAY $USER # this is not reached fi # some output for easy debugging echo "$0: could not find the sessreg utility, cannot update wtmp and utmp" exit 0 --end gdm/PreSession/Default-- Here are the contents of the ~/aging file: TIME is 1055258058 CHANGE is EXPIRED is Does any one have any idea why that perl command is not working when run in the gdm PreSession/Default script? Thanks. -- Glenn Johnson USDA, ARS, SRRC Phone: (504) 286-4252 New Orleans, LA 70124 e-mail: gjohnson@srrc.ars.usda.gov