LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 10-09-2003, 01:53 PM   #1
case1984
Member
 
Registered: Feb 2003
Location: Baton Rouge, LA
Distribution: ubuntu
Posts: 137

Rep: Reputation: 15
"service __ restart" bash command isn't working


There is probably a very simple answer to this question that I'm just not seeing 'cause I'm a total noob, but here goes:

If I'm in a Bash Shell (or midnight commander or linux console) logged in as root I can stop and start services all I want. If I am logged on as a user I can't. Even if I su root it still gives me the error message "bash: service: command not found"

I'm pretty sure there has got to be a way to fix this, but I'm not sure how.

TIA,
michael
 
Old 10-09-2003, 01:55 PM   #2
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 47
do
/sbin/service ...
as root. Or become root using
su -
 
Old 10-09-2003, 01:59 PM   #3
case1984
Member
 
Registered: Feb 2003
Location: Baton Rouge, LA
Distribution: ubuntu
Posts: 137

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by quatsch
do
/sbin/service ...
as root. Or become root using
su -
OK, yeah... I'm a moron I didn't realise su root and su - root are different.

but I don't know what this means "do
/sbin/service ..."
can someone explain?

Thanks,
michael
 
Old 10-09-2003, 02:02 PM   #4
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 47
e.g.
/sbin/service servicename start
instead of
service servicename start

when you just type in service, the system will look for service in your path. If it's not there, it will tell you 'command not found'. If you specify the path, e.g. /sbin/service, it will run the thing specified.
 
Old 10-09-2003, 02:03 PM   #5
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
After you su to root in a console, just type:

/sbin/service

and then the name of the service and then the action start/stop/restart.

slight
 
Old 10-09-2003, 02:05 PM   #6
slightcrazed
Member
 
Registered: May 2003
Location: Lisbon Falls, Maine
Distribution: RH 8.0, 9.0, FC2 - 4, Slack 9.0 - 10.2, Knoppix 3.4 - 4.0, LFS,
Posts: 789

Rep: Reputation: 30
sorry quatsch, simultaneous post.

slight
 
Old 10-09-2003, 02:06 PM   #7
case1984
Member
 
Registered: Feb 2003
Location: Baton Rouge, LA
Distribution: ubuntu
Posts: 137

Original Poster
Rep: Reputation: 15
alright thanks,
both of those work!
 
Old 10-22-2007, 04:02 PM   #8
Dovid
LQ Newbie
 
Registered: Sep 2003
Posts: 21

Rep: Reputation: 0
Run man su. In there it says to do this:
su root -l
You should not have issues then (you wont need to go in to /sbin to do anything).
 
Old 04-10-2008, 12:28 PM   #9
smithwicks
LQ Newbie
 
Registered: Apr 2008
Location: Kerry, Ireland
Distribution: fc8
Posts: 2

Rep: Reputation: 0
How do you add the 'service' to your path ?

Quote:
Originally Posted by quatsch View Post
e.g.
/sbin/service servicename start
instead of
service servicename start

when you just type in service, the system will look for service in your path. If it's not there, it will tell you 'command not found'. If you specify the path, e.g. /sbin/service, it will run the thing specified.
how do you add the 'service' to your path
 
Old 04-10-2008, 03:35 PM   #10
dbmacartney
Member
 
Registered: Mar 2007
Location: London, UK
Distribution: Debian, Red Hat Enterprise, Fedora
Posts: 70

Rep: Reputation: 15
what you will find is that /sbin is not in your path. if you type in "echo $PATH" you will see your current path settings for the user that you are running the command for. if you run "echo $PATH" again but as the root user you will see that the root user has extra path settings. It is possible to modify your own path, but for most things you want to do, you can either type in /sbin/command for example if it is something quick you want to do. or alternatively, if you require root access, eg to install something or to modify your system in any way, you can use the sudo command. e.g. "sudo service network restart" if you wish to restart your networking service.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
counter part of "service network restart" b0nd Slackware 5 10-10-2005 07:47 AM
Bash: "after" or "waitfor" command enemorales Programming 3 06-15-2005 01:04 AM
bash command is Not working in "root" jchun Linux - Newbie 2 10-26-2004 02:27 PM
What's there in suse in place of "service" command in redhat?? ankitgdit Linux - Software 2 10-09-2003 02:07 AM
"linuxconf" command not working in bash!! sharathkv Linux - Newbie 2 07-29-2003 12:00 AM


All times are GMT -5. The time now is 06:45 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration