Exporting Variables from Other Profiles
Hi
I'm trying to put together an init script to stop and start Ingres on a few machines. The problem is that the hosts have differently engineered Ingres installations so the bin type folders are in different locations. Ideally I would like a '1 script fits all' and the idea we were working with was calling the .profile of the ingres user which always sits in /home/ingres. The script I have so far is as follows: Code:
su - ingres -c ". $HOME/.profile" If I go through this step by step I get the expected results i.e. the ingres variables. Can anyone please help? |
$HOME is evaluated as the home of the current user (=root). Probably you would write ~ingres/.profile instead
Also the result of -c ". command" will be valid only inside the su - ingres shell, after returning to root you will loose that settings. Probably you only need . ~ingres/.profile without su - ingres -c |
Quote:
I had already considered running the profile without the su command but didn't want to break roots profile because PATH and LD_LIBRARY_PATH already exist. Is that likely to happen? |
If you really want to say thanks please press YES in the bottom right corner.
usually the profiles (like ~ingres/.profile) will only extend PATH and LD_LIBRARY_PATH, that will not cause any problem, but if you are in doubt just check it! |
The main point is that as soon as this line completes
Code:
su - ingres -c ". $HOME/.profile" You need to put everything you need into a script and than call it like you called the profile file. |
All times are GMT -5. The time now is 07:57 AM. |