    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>Linux.com :: how to make service in linux</title>
        <link>http://www.linux.com/archive/forums/topic/2660</link>
        <description>Everything Linux and Open Source</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Linux.com Admin</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.linux.com" /> 
        <admin:errorReportsTo rdf:resource="mailto:noreply@linux.com" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>



<div class="xarbb-noteswrapper">
</div>

   <div class="xarbb-noteswrapper">
       <div class="xar-sub rightnote">
           <div>
                    <a href="http://www.linux.com/archive/forums/topic/2458">
Previous Topic</a>
|
                    <a href="http://www.linux.com/archive/forums/topic/2770">
Next Topic</a>
</div>

           <div>
                    <a href="http://www.linux.com/archive/forums/printtopic/2660?theme=print">
Print this topic</a> |
You are not subscribed            </div>
        </div>
        <div style="clear: both;"></div>
    </div>

    <h1>
        <a class="xar-title" href="http://www.linux.com/archive/forums/topic/2660">how to make service in linux</a>
   </h1>


   <div class="xarbb-topiccontrols">
<form action="http://www.linux.com/archive/forums?func=jump" method="post">
   <label for="xarbb_jump_menu">Forum Jump</label>
    <select name="f" id="xarbb_jump_menu" onchange="this.form.submit();">
        <optgroup label="Options">
            <option value="5" selected="selected">
Please select forum            </option>
            <option value="5">--------------------</option>
        </optgroup>
        <optgroup label="Forums">
                <option value="1">New to Linux</option>
                <option value="2">Hardware</option>
                <option value="3">Linux Distributions</option>
                <option value="4">Applications</option>
                <option value="5">Programming and Development</option>
                <option value="6">Miscellaneous Discussion</option>
                <option value="7">Linux.com Writers Forum</option>
                <option value="8">Jobs</option>
        </optgroup>
    </select>
    <input type="submit" class="button" value="Jump" />
</form>
<div style="clear: both;"></div>
   </div>

   <div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>
<div style="clear: both;"></div>
   </div>

<div class="xarbb-tablewrapper">



   <table>
       <tr>
           <th scope="col">
Author</th>
           <th scope="col">
Message</th>
       </tr>



            <tr>
                <td class="xar-norm author">
                    <div>
                        <a href="http://www.linux.com/archive/roles/409000">abdul jalil</a>
                   </div>
                   <div class="xar-sub">
Joined: Aug 29, 2008<br/>Posts: 1                        <br />
                        <a href="http://www.linux.com/archive/forums?by=409000&amp;func=searchtopics">
Other Topics</a>
                   </div>
               </td>

               <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted Aug 30, 2008 at 7:31:36 AM</span>
                       </div>



<div style="float: left;">
                           <strong class="xar-sub">
Subject: how to make service in linux                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div>
                        i can run the progame when the systum start but it will stuck in accepting the connection i want to make this as a sercive which will run in background . 

i have tested the follow procedure for making the service

1) first i make the script &quot;myserver.sh&quot; that is as follows 

#! /bin/sh -e

# Check for daemon presence
test -x /usr/sbin/acpid || exit 0

# Check for ACPI support on kernel side
[ -d /proc/acpi ] || exit 0

# Include acpid defaults if available
OPTIONS=&quot;&quot;
if [ -f /usr/local/IPORT-CLIENT/runudps.sh  ] ; then
	. /usr/local/IPORT-CLIENT/runudps.sh 
fi

# Get lsb functions
. /lib/lsb/init-functions
. /etc/default/rcS

if [ &quot;x$VERBOSE&quot; = &quot;xno&quot; ]; then
        MODPROBE_OPTIONS=&quot;$MODPROBE_OPTIONS -Q&quot;
        export MODPROBE_OPTIONS
fi

# As the name says. If the kernel supports modules, it'll try to load
# the ones listed in &quot;MODULES&quot;.
load_modules() {
        PRINTK=`cat /proc/sys/kernel/printk`
        [ &quot;$VERBOSE&quot; = no ] &amp;&amp; echo &quot;0 0 0 0&quot; &gt; /proc/sys/kernel/printk
        
        LIST=`/sbin/lsmod|awk '!/Module/ {print $1}'`

	# Get list of available modules
        LOC=&quot;/lib/modules/`uname -r`/kernel/drivers/acpi&quot;
        LOC2=&quot;/lib/modules/`uname -r`/kernel/ubuntu/acpi&quot;
        if [ -d $LOC ]; then
	  MODAVAIL=`( find $LOC -type f -name &quot;*.o&quot; -printf &quot;basename %f .o\n&quot;; \
		find $LOC -type f -name &quot;*.ko&quot; -printf &quot;basename %f .ko\n&quot; ) | /bin/sh`
	else
	  MODAVAIL=&quot;&quot;
	fi

        if [ -d $LOC2 ]; then
	  MODAVAIL=&quot;$MODAVAIL `( find $LOC2 -type f -name &quot;*.o&quot; -printf &quot;basename %f .o\n&quot;; \
		find $LOC2 -type f -name &quot;*.ko&quot; -printf &quot;basename %f .ko\n&quot; ) | /bin/sh`&quot;
	fi

        if [ &quot;$MODULES&quot; = &quot;all&quot; ]; then
		MODULES=&quot;$MODAVAIL&quot;
        fi

	if [ -n &quot;$MODULES&quot; ]; then
		log_begin_msg &quot;Loading ACPI modules...&quot;
		STATUS=0
	        for mod in $MODULES; do
			echo $MODAVAIL | grep -q -w &quot;$mod&quot; || continue
		        if echo $LIST | grep -q -w &quot;$mod&quot;; then
				[ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_success_msg &quot;Module already loaded: $mod&quot;
			else
				if modprobe -b $mod 2&gt;/dev/null; then
					[ &quot;$VERBOSE&quot; != no ] &amp;&amp; log_success_msg &quot;Loaded module: $mod&quot;
				else
					if [ &quot;$VERBOSE&quot; != no ]; then
						log_warning_msg &quot;Unable to load module: $mod&quot;
					fi
				fi
			fi		
	        done
		log_end_msg $STATUS
	fi
        echo &quot;$PRINTK&quot; &gt; /proc/sys/kernel/printk
}

case &quot;$1&quot; in
  start)
    [ -f /proc/modules ] &amp;&amp; load_modules
    log_begin_msg &quot;Starting ACPI services...&quot;
    start-stop-daemon --start --quiet --oknodo --exec /usr/local/IPORT-CLIENT/runudps.sh -- -c /etc/acpi/events $OPTIONS
    log_end_msg $?
    ;;
  stop)
    log_begin_msg &quot;Stopping ACPI services...&quot;
    start-stop-daemon --stop --quiet --oknodo --retry 2 --exec /usr/local/IPORT-CLIENT/runudps.sh 
    log_end_msg $?
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  reload|force-reload) 
    log_begin_msg &quot;Reloading ACPI services...&quot;
    start-stop-daemon --stop --signal 1 --exec /usr/local/IPORT-CLIENT/runudps.sh 
    log_end_msg $?
    ;;
  *)
    log_success_msg &quot;Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload}&quot;
    exit 1
esac

exit 0


after makeing the script i have run the follow command 
sudo update-rc.d -f myserveice.sh defaults
sudo chmod +x /etc/init.d/myserveice.sh

</div>

                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/2660#top">
Back to top</a>
</td>
               <td class="xar-alt">

                        <a href="http://www.linux.com/archive/roles/409000">
                            <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                        </a>
                        <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=409000">
                            <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                       </a>
                            <a href="http://">
                                <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                           </a>
</td>
           </tr>





           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/379079">
                                Shashank Sharma                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jan 01, 1970<br/>Posts: 1657<br />
Location:New Delhi, India<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=379079&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-accent message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Sep 07, 2008 6:07:40 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1198107" href="http://www.linux.com/archive/forums/topic/2660#1198107">
                                    how to make service in linux                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        Shouldn't you chmod before running the update-rc.d command?

http://www.debuntu.org/how-to-manage-services-with-update-rc.d
https://help.ubuntu.com/community/UbuntuBootupHowto
<p class="hiddensignature">
Coauthor of <a href="http://www.amazon.com/Beginning-Fedora-Novice-Professional/dp/1590598555">Beginning Fedora: From Novice to Professional</a> published by <a href="http://www.apress.com">Apress</a>.
<br><br>
Please follow the <a href="http://www.linux.com/forums/topic/1665">Forum Guidelines</a></p>
                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/2660#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/379079">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=379079">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://linuxlala.net/">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
                                <a href="http://edit.yahoo.com/config/send_webmesg?.target=linuxlala&amp;.src=pg">
                                    <img src="modules/xarbb/xarimages/new/icon_yim.gif" alt="Yahoo!" />
                               </a>
</td>
           </tr>
</table>
</div>

<div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>

</div>



            </channel>
</rss>
