Solved

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

Posted on 2014-02-28
12
426 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 23

Expert Comment

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

Expert Comment

by:serialband
ID: 39896216
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
ID: 39899270
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Assisted Solution

by:ThomasMcA2
ThomasMcA2 earned 100 total points
ID: 39899479
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
ID: 39899487
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
ID: 39899490
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
 
LVL 29

Accepted Solution

by:
serialband earned 400 total points
ID: 39899693
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
ID: 39901478
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
ID: 39901620
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 29

Assisted Solution

by:serialband
serialband earned 400 total points
ID: 39901679
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
ID: 39901720
Thank you, since I already got this issue solved, I will close this case, thank you all.
0
 

Author Closing Comment

by:Jason Yu
ID: 39901729
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ubuntu not booting - How get past GRUB? 3 77
CENTOS DHCP Server / PXE/TFTP 14 204
NTPD Client Port Usage 12 62
Advice on ESXi 5.1 Health / Storage 1 41
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

735 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