LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 06-26-2012, 09:06 AM   #1
pmishra
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Rep: Reputation: Disabled
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

/etc/initscript entry for executing "test":-
eval exec /usr/bin/sudo -u testUser /<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?
 
Old 06-26-2012, 09:13 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can still use the "service" command to manually start services. That is how you should have done it before.
 
Old 06-26-2012, 09:31 AM   #3
pmishra
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-28-2012, 12:04 AM   #4
pmishra
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Adding more 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.
 
Old 06-30-2012, 03:03 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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

This blog might help in migtating your startup script to upstart: http://newcome.wordpress.com/2012/02...using-upstart/

Last edited by jschiwal; 06-30-2012 at 03:32 AM.
 
Old 07-02-2012, 12:20 AM   #6
pmishra
LQ Newbie
 
Registered: Jun 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.

Thanks.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[problem] Hal not starting properly GuitarMaster Linux - Software 2 04-13-2009 03:55 AM
Nagios not starting up properly hondo Linux - Server 2 04-07-2007 02:24 PM
X not starting up properly after upgrade, need help... Dizaplyn Slackware 1 11-14-2006 06:08 PM
Won't Boot - Starting Printer Service - Starting CUPS jeansond Linux - Newbie 0 10-11-2004 06:39 PM
my mozzila is not starting properly bajaj Linux - Software 0 08-09-2003 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration