Results 1 to 10 of 10
please can anyone help.
i need to get root user environment when run e.g. "/sbin/service myapp start"
i have tried to include these lines in /etc/init.d/myapp:
. /etc/profile
. /root/.bash_profile
...
- 07-03-2009 #1Just Joined!
- Join Date
- Jul 2009
- Posts
- 5
how to get user environment into /sbin/service
please can anyone help.
i need to get root user environment when run e.g. "/sbin/service myapp start"
i have tried to include these lines in /etc/init.d/myapp:
. /etc/profile
. /root/.bash_profile
but i still cannot get the environment as logged on as root, verified by set.
i am using rhel 4.8
thanks
zcw
- 07-03-2009 #2Linux Newbie
- Join Date
- Mar 2009
- Posts
- 228
The problem is you can't access /root/.bash_profile because the permissions on the /root directory doesn't allow non-root users to access it.
You could change the permisions on the /root directory so non-root users has access it but strongly not adviced.
The thing to do would be take the parts of .bash_profile that non-root users need and place it in another script somewhere that anyone can access it and execute that.
- 07-03-2009 #3Just Joined!
- Join Date
- Jul 2009
- Posts
- 5
but "/sbin/service myapp start" is run by root, so it should have access to /root/*
- 07-03-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,485
You can write a script that sources /root/.bash_profile and then executes /sbin/service. You still need to be root to do this.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-03-2009 #5Just Joined!
- Join Date
- Jul 2009
- Posts
- 5
- 07-03-2009 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,485
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-03-2009 #7Just Joined!
- Join Date
- Jul 2009
- Posts
- 5
en, i think that i may need to expand my problem description a little bit. it is grails/spring we used in our website, which is served by tomcat has this problem. Without this bit of grails/spring, tomcat works fine and can be started/stopped using /sbin/service. once this grails/spring is included, we can only start tomcat using any of the following:
/etc/init.d/tomcat start
/etc/rc5.d/S80tomcat start
$CATALINA_HOME/bin/startup.sh
but "/sbin/service tomcat start" does not work and most importantly, tomcat will not start on reboot. even if i put $CATALINA_HOME/bin/startup.sh in /etc/rc.local, tomcat still cannot start on reboot.
Obviously, i have posted in tomcat and grails user groups, but no clue.
- 07-03-2009 #8Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,485
Thanks for the expansion of the situation. It's the "little" details like this that can save everyone a lot of time and effort giving you the wrong advice...
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-03-2009 #9Just Joined!
- Join Date
- Jul 2009
- Posts
- 5
hi
your inputa are very useful. i think that the problem is the environment. if i gave all the details it not likely i will have any suggestions.
thank very much i will try ut your suggestions wehn i can play with the server.
- 07-03-2009 #10Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,485
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote

