In RHEL-6.2, service not starting properly from upstart
Red HatThis forum is for the discussion of Red Hat Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
In RHEL-6.2, service not starting properly from upstart
Hi All,
Below is the problem description that I am facing. Request your quick response.
We use RHEL as base OS for one of our application. Till RHEL5, we used to start a service say "test" from init. /etc/inittab entry for "test":-
22:345:respawn:/<path>/test
Now we moved to RHEL6. Here inittab is deprecated and replaced by upstart.
so, I created test.conf in /etc/init/ directory. Entry in test.conf:-
start on stopped rc RUNLEVEL=[345]
stop on starting runlevel [0126]
respawn
exec /usr/bin/sudo -u testUser /<path>/test
Now if I try to start my service by running "start test", the process gets started, but not properly.
If I try to start it as root and not testUser, it gets started properly.
Please let me know why is this behavior when test is started as different user other than root. What should be changed here, either in upstart or sudoers to get this working?
Thanks for your quick response.
Do you mean I don't need to use upstart?
As far as service command is concerned, we have a startup script for "test" say StartTest. So in RHEL5, whenever we executed "service StartTest start", this script will echo "22:345:respawn:/<path>/test" in inittab followed by "telinit q". This would result in re-reading of inittab which would eventually execute "test"
Since in RHEL6, inittab is only used to get the default runlevel, I don't think service command will work here.
I found that the pid shown by initctl and ps are different if i use sudo where as it is same if sudo is not used. When pid is same the service is getting started properly.
Would request someone in the forum to help me on this.
From what I read the "service" command is still supported.
I'm surprised that RHEL uses upstart since RedHat wrote systemd. You might expect them to switch to systemd at some time.
According to this site, you can still use "chkconfig" to enable and disable services and set the run levels. From the way you described how you started the service before upstart, I wonder whether or not you prepended the required header comments to your startup script. http://searchenterpriselinux.techtar...s-need-to-know
Thanks for your response. Couple of days back the issue got resolved.
Yes, from RHEL6 onwards RedHat is using upstart. Actually my service expects to be started from init (process id 1).
The sudo rpm that was packaged with RHEL6.2 was not not working properly here. When I tried to start the service with sudo, it used to get started by init but the actual binay (here test) was not having init as parent process.
I went for older version of sudo and the issue got resolved.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.