I’m having an issue here, I have installed Documentum on the openSuse and EMC doesn’t provide any startup (start/stop/restart) script for /etc/init.d and I wrote my own. I have bunch of env variables that are required to start/stop Documentum and they are all set in the ~/.profile of “dmadmin” (its the user that start/stop Documentum) now when I use the following script, I get error that Env Variable not found.
#!/sbin/sh
case "$1" in
'start')
su - dmadmin -c "/opt/documentum/dba/dmservices $1"
;;
'stop')
su - dmadmin -c "/opt/documentum/dba/dmservices $1"
;;
esac
Can somebody tell me how to load Env variables from “su” that are set for some other user?
First, I do not know how to do this, if ‘su’ or ‘sudo’ even can do this.
A couple of thoughts… first, is there really a shell (or symlink to a
shell) in /sbin as your #! line would indicate? My box does not have
one so maybe that’s interfering with things.
Second, why not duplicate the variables into the init script? Another
option, separate out the variable initializations to their own file
(~dmadmin/dm-env-vars.sh) and then source that, both in your
~dmadmin/.profile script as well as in your
/opt/documentum/dba/dbmservices script:
source ~dmadmin/dm-env-vars.sh
Doing this you would have a single source of the environment variables
and you could have any user needing them pull them in. It may be better
to place something like this in the /opt/documentum directory structure
for wider access too.
Good luck.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> Can somebody tell me how to load Env variables from “su” that are set
> for some other user?
When you do “su - dmadmin” you get the environment variables of user
“dmadmin”, and this is correct and as it should be. Some variables from the
calling user are cleared out, as specified in the su manual, with the
exceptions listed in the sudoers file.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)