LinuxQuestions.org
Visit Jeremy's Blog.
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 09-05-2014, 04:31 PM   #1
linuxuser26
LQ Newbie
 
Registered: Nov 2008
Posts: 8

Rep: Reputation: 0
Running service command as root in a daemon on RHEL 6.5


I'm able to run the following command as root from the command prompt on RHEL 6.5.

service start|stop|restart|status

but when I try to run this command from a daemon process(shell script) as root,it says that the service command is not found.

[root ~]# whereis service service: /sbin/service

Could someone help me understand why that happens?

I also have to add that my script runs resides in the /etc/init.d directory.
 
Old 09-06-2014, 03:18 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Either expand the $PATH the script uses or prefix full paths always?
 
Old 09-12-2014, 11:22 AM   #3
GaWdLy
Member
 
Registered: Feb 2013
Location: San Jose, CA
Distribution: RHEL/CentOS/Fedora
Posts: 457

Rep: Reputation: Disabled
Use full paths.
 
  


Reply

Tags
rhel 6, service, shell script



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
service : command not found in RHEL 5 aneetaa Linux - Newbie 4 09-04-2012 11:03 AM
[SOLVED] Problem with running PostgreSQL 8.4 as service on RHEL 5 server klactose Linux - Software 1 04-06-2011 06:13 AM
SCIM daemon launches when running any application as root. camphor Slackware 2 02-07-2009 12:53 PM
Enable daemon to run with service daemon start,etc baddah Programming 6 12-02-2007 05:51 PM
can't get Kerberos telnet daemon running on RHEL 3 nickgarnett Linux - Networking 0 11-21-2006 04:58 PM

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

All times are GMT -5. The time now is 09:32 AM.

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