5

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

9

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.

  • update-rc.d command not found , and its not available under /usr/sbin/ also ..... For more info am using SUSE Linux Enterprise 11 – asvignesh May 12 '14 at 11:33
  • 1
    I updated the answer, hope this will help. – Danatela May 12 '14 at 11:57
  • 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 May 12 '14 at 12:11
  • 1
    OK I will download SLES and test it... – Danatela May 12 '14 at 12:20
  • 2
    You don't need to upvote each my comment ;) What does chkconfig tell to you? – Danatela May 12 '14 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.