• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

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

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.
Jason Yu
Jason Yu
3 Solutions
What flavor of Linux are you using?  The service script should not have to be copied, it exists on most Linux systems.
Are you sure you have gentran installed correctly?  Did it put a script in init.d for the service command to start and stop?
Jason YuAuthor Commented:
No, for some unknown reason, I don't see a service named "gentran" under /etc/rc.d/init.d. How should I remedy this?

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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.
Jason YuAuthor Commented:
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.

Jason YuAuthor Commented:
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.

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.
Jason YuAuthor Commented:
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.
Jason YuAuthor Commented:
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
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.
Jason YuAuthor Commented:
Thank you, since I already got this issue solved, I will close this case, thank you all.
Jason YuAuthor Commented:
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now