How to make a service start in SUSE Enterprise linux

6

2

I created a app and the service file , You can start / stop / restart the service ... I want to start that service at the time of booting of Suse Enterprise linux , I tried adding that file in /etc/init.d/my-service but its not getting started on boot

asvignesh

Posted 2014-05-12T10:32:16.993

Reputation: 447

Answers

10

You have to add this file into desired runlevel. For example:

sudo update-rc.d my-service default

Will add it into default runlevel in Debian-based distros. Also, be sure that the file has such structure:

#!/bin/bash
case "$1" in
    start)
        #do startup commands
        ;;
    stop)
        #do stop commands
        ;;
 esac

However, in SUSE Linux there is /etc/init.d/skeleton that should be edited to create new scripts. This skeleton contains special comments (they are comments for the shell, but used by YaST) to describe on which runlevels the start/stop must be.

Once done, the script will show in YaST → System → System Services (runlevel) and can be switched on/off from there (making the links, etc).

To enable a service you can also use chkconfig, as in:

chkconfig --set someservice on

or

chkconfig --set someservice off

and the appropriate links will be created/deleted. For finer control over levels, you can use

chkconfig --level 35 someservice on

Source: OpenSUSE update-rc.d equivalent.

Danatela

Posted 2014-05-12T10:32:16.993

Reputation: 434

update-rc.d command not found , and its not available under /usr/sbin/ also ..... For more info am using SUSE Linux Enterprise 11 – asvignesh – 2014-05-12T11:33:58.517

1I updated the answer, hope this will help. – Danatela – 2014-05-12T11:57:40.233

Still no luck and one more issue ... when i start the service form /etc/init.d/my-service start its working fine but if i try service my-service start didn't start my app – asvignesh – 2014-05-12T12:11:02.423

1OK I will download SLES and test it... – Danatela – 2014-05-12T12:20:22.290

hey dont waste resource for this thing .... i u have any suggetions let me know – asvignesh – 2014-05-12T12:21:52.263

2You don't need to upvote each my comment ;) What does chkconfig tell to you? – Danatela – 2014-05-12T14:58:52.187