Link to home
Start Free TrialLog in
Avatar of Jason Yu
Jason YuFlag for United States of America

asked on

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.
service
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

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?
Avatar of Jason Yu

ASKER

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.
SOLUTION
Avatar of ThomasMcA2
ThomasMcA2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you, since I already got this issue solved, I will close this case, thank you all.
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