    <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 :: Executing a program at startup using a script</title>
        <link>http://www.linux.com/archive/forums/topic/2118</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/2169">
Previous Topic</a>
|
                    <a href="http://www.linux.com/archive/forums/topic/2106">
Next Topic</a>
</div>

           <div>
                    <a href="http://www.linux.com/archive/forums/printtopic/2118?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/2118">Executing a program at startup using a script</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="1" selected="selected">
Please select forum            </option>
            <option value="1">--------------------</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/1">
        New to Linux   </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/405425">Raj</a>
                   </div>
                   <div class="xar-sub">
Joined: Jun 26, 2008<br/>Posts: 8                        <br />
                        <a href="http://www.linux.com/archive/forums?by=405425&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 Jun 26, 2008 at 5:55:47 PM</span>
                       </div>



<div style="float: left;">
                           <strong class="xar-sub">
Subject: Executing a program at startup using a script                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div>
                        I need to execute a program at startup in suse linux. For this, I created a script with name S99scadamonitor with following lines and copied  the script to rc3.d and rc5.d.  Runlevel of the system was found to be 5 when I used 
who -r. 

#! /bin/sh
/etc/local/scada/scmon 2 3 40

scmon is the program and 2 3 40  are command line arguments.

But, this script doesnot get executed. If the script is executed, then scmon is exected, and then it will fork into memory. I can click on the scipt and the script executes fine. It works in terminal mode also. (scmon The program starts normally and forks into memory as a background process, which can be seen later in system monitor.)

Where  do you think is the mistake? </div>

                </td>
            </tr>

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

                        <a href="http://www.linux.com/archive/roles/405425">
                            <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=405425">
                            <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/401955">
                                Khabi                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Apr 21, 2008<br/>Posts: 121<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=401955&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:
                                Jun 26, 2008 7:28:09 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193187" href="http://www.linux.com/archive/forums/topic/2118#1193187">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        init scripts can be tricky.  I haven't used suse in a long time, but it seems you're missing something like this at the top of your init script:  
### BEGIN INIT INFO
# Provides: FOO
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start FOO to allow XY and provide YZ
### END INIT INFO

On top of that init scripts usually need to take arguments like stop/start/restart, I'm not sure how suse is going to handle it w/o those. 
From what I understand there should be an init script in /etc/init.d/skeleton that you can use as a template.

The other option is if scmon doesn't need to be started before networking then, add it to /etc/init.d/boot.local                      </div>
                </td>
            </tr>

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

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/401955">
                                <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=401955">
                                <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/405425">
                                Raj                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jun 26, 2008<br/>Posts: 8<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=405425&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Jun 27, 2008 6:33:05 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193234" href="http://www.linux.com/archive/forums/topic/2118#1193234">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        In my suse machine, rc.d is mapped to init.d. skeleton is not existing in the folder.
 Actually, I have an installation script, which copries the files from cd and then configures the program to autostart. I used to insert the  line in rc.local using this installation script for sutostart. But then, I am forced to change that method since there is no rc.local file in suse.  This script was tested in Redhat, and is working properly, but then when I tried it in Suse, it doesn't work since rc.local is simply not there!!

The script /etc/init.d/boot.local is available in suse. But is it available in all linux vserions? (Since I am using an installation script to configure autostart in target machines, the script is expected to work in all linux flavours!)                    </div>
                </td>
            </tr>

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

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/405425">
                                <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=405425">
                                <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/405425">
                                Raj                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jun 26, 2008<br/>Posts: 8<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=405425&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:
                                Jun 27, 2008 10:27:53 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193242" href="http://www.linux.com/archive/forums/topic/2118#1193242">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        Is it necessary to use chkconfig and add the program to bootup?                    </div>
                </td>
            </tr>

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

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/405425">
                                <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=405425">
                                <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/405543">
                                klo                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jun 28, 2008<br/>Posts: 1<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=405543&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Jun 28, 2008 7:12:50 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193376" href="http://www.linux.com/archive/forums/topic/2118#1193376">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        I'm not sure if suse supports upstart, if it does, try something like this in /etc/event.d (you can name it whatever you want):

[code]
start on runlevel 5

script
        /etc/local/scada/scmon 2 3 40
end script
[/code]

Good luck!                    </div>
                </td>
            </tr>

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

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/405543">
                                <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=405543">
                                <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/405425">
                                Raj                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jun 26, 2008<br/>Posts: 8<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=405425&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:
                                Jul 02, 2008 4:15:09 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193654" href="http://www.linux.com/archive/forums/topic/2118#1193654">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        Tried the format suggested. But that script doesn't get executed at start up. Copied existing scripts and edited. Doesn't work. Used names starting from S. Copied to init.d and inserted links in rc3.d, rc5.d. Nothing works!! My script doesn't get executed. If I insert the code in boot.local, then it works, but, I don't get any visual indications etc. Like, the popups which were supposed to come doesn't come !! But then probably , that is the default behaviour, since boot.local is executed before all runlevels. In red hat, it works fine if I insert the code in rc.local. But in Suse, rc.local is doesn't exist. If I create rc.local (by copying boot.local and editing it, or by copying rc.local from redhat and editing it), then that is totally ignored by Suse. I am trying the event.d suggestion now, and hope it works...                    </div>
                </td>
            </tr>

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

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/405425">
                                <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=405425">
                                <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-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Jul 04, 2008 11:16:11 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1193808" href="http://www.linux.com/archive/forums/topic/2118#1193808">
                                    Executing a program at startup using a script                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        I can find all these solutions to your predicament. 

http://www.linuxforums.org/forum/suse-linux-help/21533-how-do-i-add-scripts-system-startup.html
http://www.linuxquestions.org/questions/susenovell-60/run-script-at-startup-382018/
http://forums.opensuse.org/archives/sf-archives/install-boot/340570-how-run-custom-script-startup.html

Cheers!<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/2118#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/1">
        New to Linux   </a>
</span>

</div>



            </channel>
</rss>
