Urgent help request! was Re: how do you get something to run when a user logs on?

john lists.john at gmail.com
Sun Aug 31 22:21:55 BST 2008


Hi all,

I am two days away from the start of school and the problem I
described before still applies to me. If I can't figure this out I'll
have to put off my upgrade to 8.04 (or 8.10 perhaps) until December.
I'd really appreciate any help.

This issue is I want to run some scripts that up until now have been
called by /etc/profile. This has worked for me up through Edubuntu
7.04 The scripts use the system variables $HOME and $USER to map NFS
shares to users desktops. I understand from oli and others that the
image generated by 8.04 doesn't reference /etc/profile when users log
in.

When I tried calling these scripts from
/etc/X11/Xsession.d per Ollies suggestion the scripts didn't seem to
run, and in fact after accepting my credentials X just sent me back to
the login screen,  perhaps my syntax was incorrect. But I couldn't
find any debug information in the logs to trouble shoot the issue.
Where do I find more debug info?

francois suggestion about putting the lines in
/opt/ltsp/i386/etc/profile and then updating the image didn't work
either.

Below is the what I placed in my file called /etc/X11/Xsession.d/85-SetupHome:


#!/bin/sh
#
# SetupHome.sh
#	Clean up from previous session
#
# Sweep all files from $HOME and $HOME/Desktop to $HOME/Desktop/ZDrive
#  (ignores directories).
# Makes Desktop and ZDrive dir entries if needed.
#

# Name of desktop itself
dt=$HOME/Desktop
if [ ! -e $dt ]
then
    mkdir $dt
fi

# Name of ZDrive on Desktop
zd=$dt/ZDrive

# Storage server, and pre-built index of students on the server
server=/mnt/ALLSTUDENTS
index=$server/index.students

# Make sure username is all lower case
user=`echo $USER | tr A-Z a-z`

# Zdrive does not exist, go figure it out
if [ ! -e $zd ]
then

    # Search file server for this user's directory
    if grep "/$user"'$' $index > /tmp/us$$
    then
	store=$server/`cat /tmp/us$$`
    else
	# N.B., must fix for y3k compatibility
	store=$server/2*/$user
    fi
    rm -f /tmp/us$$

    # Teachers, for instance, won't have storage on student fileserver
    if [ -e $store ]
    then
	ln -s $store $zd
    else
	# No ZDrive available for this user, just quietly leave
	exit 0
    fi
fi

# If the user created files in the home directory, move them down
# to the Desktop
for src in "$HOME" "$dt"
do
    # Walk entries in this dir
    cd $src
    for x in *
    do
	# Only process *files* in this dir
	if [ -f "$x" ]
	then
	    # Calculate default destination
	    dest="$zd/$x"

	    # Oops, already there, concatenate an index number
	    if [ -e "$dest" ]
	    then
		# Start with <foo>_0, and count up until an opening is found
		count=0
		dest2="$zd/$count""_$x"
		while [ -e "$dest2" ]
		do
		    count=`expr $count + 1`
		    dest2="$zd/$count""_$x"
		done
		cp "$x" "$dest2" && rm -f "$x"
	    else
		cp "$x" "$dest" && rm -f "$x"
	    fi
	fi
    done
done


exit 0



On Thu, Aug 28, 2008 at 8:27 AM, Oliver Grawert <ogra at ubuntu.com> wrote:
> hi,
> On Do, 2008-08-28 at 08:03 -0700, john wrote:
>> Hi all,
>>
>> I was wondering where I can put scripts that I want to run when a user
>> logs on to a thin client. I used to put them in /etc/profile but that
>> doesn't seem to work under Hardy. It seems like LDM is somehow
>> by-passing the stuff I put there. Can someone help me out?
> ldm is executing /etc/X11/Xsession by default ... (like gdm or kdm do)
> one option would be to put stuff into /etc/X11/Xsession.d, another is to
> use the xdg autostart mechanism in /etc/xdg/autostart
>
> ciao
>        oli
>
> --
> edubuntu-users mailing list
> edubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/edubuntu-users
>
>



More information about the edubuntu-users mailing list