Operating System - HP-UX
1752733 Members
5768 Online
108789 Solutions
New Discussion юеВ

How to force a source of .profile for hpterm with -e option used?

 
dave_nycues
Occasional Contributor

How to force a source of .profile for hpterm with -e option used?

I am using reflection to create an hpterm over ssh to then run an X windows application. We typically used rlogin but we are trying to migrate to ssh. The command used to launch the term is

(/usr/bin/X11/hpterm -ls -fn 6x13 -sb -display %IP#% -name %T% -e &)

However, since we are using the -e option, hpterm will not consider this is a login shell and thus not run the .profile. When using rlogin, it would source the profile.

I tried the following:
1) .dtprofile does have the last line uncommented but it doesn't help. I put a test echo in that file and it too is not being sourced.
2) I created a .Xdefaults and put in *LoginShell:True
but that didn't help
3) If I take out the -e command then I see .profile, .dtprofile, and .kshrc all being sourced properly

Any help would be appreciated.
9 REPLIES 9
OldSchool
Honored Contributor

Re: How to force a source of .profile for hpterm with -e option used?

so, you log in to the server using ssh and then you enter the command specified?

is it really enclosed in ()?

the initial login (via ssh) should have run the profiles. anything at the command line would then inherit whatever the profile set, or at least my limited testing indicates that to be the case.

have you thought about substituting a script for and having the script source the profiles prior to firing off ?
Tim Nelson
Honored Contributor

Re: How to force a source of .profile for hpterm with -e option used?

Take a look at the .dtprofile in your home directory.

# If $HOME/.profile (.login) has been edited as described above, uncomment
# the following line.
#
#DTSOURCEPROFILE=true


Also, xterm works better than hpterm ( IMHO ) unless you are trying to do something really specific.

(/usr/bin/X11/xterm -fn 6x13 -sb -ls -display %IP#% -name %T% &)
dave_nycues
Occasional Contributor

Re: How to force a source of .profile for hpterm with -e option used?

I could of course modify or create a new script that sourcing the profile and then runs the app but I was hoping to implement this without having to touch anything on the server side.

To clarify, reflection is a X windows emulator like Exceed and I am using ssh as the protocol to connect to the server. The user should never get a blank xterm window. The goal is to automatically launch the application when the user clicks on the reflection session which then spawns ssh2 to connect and then an xterm using the -e option to launch an app.

DTSOURCEPROFILE=true is already uncommented.
OldSchool
Honored Contributor

Re: How to force a source of .profile for hpterm with -e option used?

Its been a while since I used Reflection/X, so bear with me....so you've set it to connect via ssh (as opposed to say tunneling with Putty then starting cde and then..)?

what happens if you set /bin/sh instead of and look at the enviroment in that shell?

With the rlogin method, how were you starting the app, as the last thing in the profile or ????
dave_nycues
Occasional Contributor

Re: How to force a source of .profile for hpterm with -e option used?

If I set the to be /bin/sh then I get a shell but the shell is not a login shell and thus .profile was not sourced.

With rlogin, reflection still provided me the ability to specify a program to run once the rlogin was succesfully which was the . I just didn't have to specify the xterm

I am now trying to create a wrapper script that will manually source the .profile and then run the app but apparently the app needs settings in /etc/profile as well so I am trying to source that too but for some reason the xterm is getting destroyed when sourcing /etc/profile. I am still investigating but this feels like a hack.
James R. Ferguson
Acclaimed Contributor

Re: How to force a source of .profile for hpterm with -e option used?

Hi Dave:

> I am now trying to create a wrapper script that will manually source the .profile and then run the app but apparently the app needs settings in /etc/profile as well so I am trying to source that too but for some reason the xterm is getting destroyed when sourcing /etc/profile.

Instead of trying to source the '.profile', collect every variable setting you need into a standalone file. Modify your existing '.profile' to source that. There is nothing to prohibit this approach. Now you have reusable code since you can source the standalone file within any script you want.

Regards!

...JRF...
OldSchool
Honored Contributor

Re: How to force a source of .profile for hpterm with -e option used?

"The goal is to automatically launch the application when the user clicks on the reflection session which then spawns ssh2 to connect and then an xterm using the -e option to launch an app."

I'm getting confused here.."reflection session" is a shortcut on the windows desktop, an icon is CDE after reflection starts or what?

ssh should allow you to specify a command as well (I would think)...taking the xterm command out of the picture..
dave_nycues
Occasional Contributor

Re: How to force a source of .profile for hpterm with -e option used?

I am talking about a shortcut on a windows machine which would then start a reflection session which would then launch an xterm over ssh. xterm by default does not start a login session. You must use -ls option for that but -ls option is ignored with the -e option.

I just got off the phone with reflection and they gave me a workaround of using a different product of theirs that allows to create a terminal window (not xterm) via ssh and then run a macro and that macro is just typing in the command for my app. It does seem to work.
Bill Hassell
Honored Contributor

Re: How to force a source of .profile for hpterm with -e option used?

Make sure that .Xdefaults is in $HOME for the user and most important, it must be in the machine which is running hpterm for you. Make sure that the Xwindow resource .Xdefaults is working by adding: *background: red

Then start xclock...it should have a red background. If not, check permissions for .Xdefaults and $HOME.


Bill Hassell, sysadmin