Solved

can't use "service start servicename" to manage a service

Posted on 2014-02-28
12
419 Views
Last Modified: 2014-03-03
HI, all:

I have set up a new linux server with gentran services on it. On the old server, there is an script called "service" under /sbin I could use to manage all service. I can run the commands like below to manage different service.

[root@luna sbin]# history | grep service
  108  /sbin/service denyhosts status
  109  /sbin/service denyhosts stop
  123  /sbin/service denyhosts status
  124  /sbin/service denyhosts start
  300  history | grep service
  301   /sbin/service gentran stop
  330  /sbin/service gentran status
  331  /sbin/service gentran start
  332  /sbin/service gentran restart
  531  /sbin/service gentran start
  537  /sbin/service denyhosts status
  538  /sbin/service denyhosts stop
  539  /sbin/service denyhosts start
  547  /sbin/service denyhosts stop
  548  /sbin/service denyhosts status
  549  /sbin/service denyhosts start
  581  /sbin/service gentran start
  583   /sbin/service gentran stop
  619  /sbin/service gentran start
  648  /sbin/service gentran stop
  649  /sbin/service gentran start
  655  /sbin/service gentran start
  754  /sbin/service gentran start


After I set up the new server, I copied this "service" script to the new server (it's quite strange, there is a script with the same name under /sbin folder, I backuped the old one and copied the new one into this folder). However, when I issued the same commands on this new server, it doesn't work at all. Did I miss some packages which are needed by this "service" script, I am coping the script here, please advise.
service
0
Comment
Question by:Jason Yu
12 Comments
 
LVL 23

Expert Comment

by:savone
Comment Utility
What flavor of Linux are you using?  The service script should not have to be copied, it exists on most Linux systems.
0
 
LVL 27

Expert Comment

by:serialband
Comment Utility
Are you sure you have gentran installed correctly?  Did it put a script in init.d for the service command to start and stop?
0
 

Author Comment

by:Jason Yu
Comment Utility
No, for some unknown reason, I don't see a service named "gentran" under /etc/rc.d/init.d. How should I remedy this?

Thanks.
0
 
LVL 14

Assisted Solution

by:ThomasMcA2
ThomasMcA2 earned 100 total points
Comment Utility
I would undo what you did to the "service" scripts. That script is provided by the distro. Unless both servers are the exact same distro and exact same version with the exact same patches installed, the copied script is likely different from the original script, and causing more problems than it solves.

So put the original service script back, run it, then reply back with any errors that it returns.
0
 

Author Comment

by:Jason Yu
Comment Utility
Hi, Thomas:

Thanks for your reply, I am glad I can get help even during weekends. Fortunately, I made a copy of the original script and will reverse the original one.

I will update once I am done.

thanks.
0
 

Author Comment

by:Jason Yu
Comment Utility
I reversed it back to the original one.

Here are the output when I ran the following commands.

[root@thea sbin]# ./service gentran status
gentran: unrecognized service
[root@thea sbin]# ./service gentran stop
gentran: unrecognized service
[root@thea sbin]#

Was it something wrong with IBM gentran software installation? This software is hard to install, I hope everything is fine with it.

thanks.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 27

Accepted Solution

by:
serialband earned 400 total points
Comment Utility
If you don't see a script in init.d, then you can't run the service command.  That script typically finds a service by that name in init.d.  This suggest that your gentran service may not have been installed correctly.

How did you install the gentran?  Do you have that service installed correctly on the old server?  Do you see gentran in init.d on the old server?  Have you followed the instructions in the installation manual?

Is this the manual you followed? http://public.dhe.ibm.com/software/commerce/doc/sb2bi/gis42/GIS42_Installation.pdf

The manual seems quite involved, so you should double check that you haven't missed any details during the install.  I actually didn't find any mention of a service being created for gentran, so I'm unsure if someone created the gentran entry in init.d.  You should check the contents to see if that was installed via the IBM install steps or if someone manually created it.
0
 

Author Comment

by:Jason Yu
Comment Utility
Hi, all, thank you guys for your replies. I got the solution now.

there is a script called gentran under /etc/rc/d/init.d/gentran, inside this script, it calls the inbuilt commands to start and stop the services. After I copied this script from our production server to the test server, I can run the "/sbin/service start gentran " now.

What are the files under /etc/rc.d/init.d for? Why I need a script with the service name as the file name inside this folder to make "/sbin/service gentran start" to work.

Please advise, thank you very much.
0
 

Author Comment

by:Jason Yu
Comment Utility
I noticed I also need update the sudoer file as below: what is the relationship between /sbin/service and /etc/init.d/*

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now
gentran         ALL=NOPASSWD: /sbin/service, /etc/init.d/gentran
0
 
LVL 27

Assisted Solution

by:serialband
serialband earned 400 total points
Comment Utility
init.d is where the service scripts live.

/sbin/service is the command that uses them.

The sudoers file just limits the command that you can run as the gentran user when you sudo.
0
 

Author Comment

by:Jason Yu
Comment Utility
Thank you, since I already got this issue solved, I will close this case, thank you all.
0
 

Author Closing Comment

by:Jason Yu
Comment Utility
Serialband and other experts:

Thank you for helping me get the solution so quick, I am glad I am a member of this community.

Have a nice week1

Jason
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now