Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-08-2010, 11:40 AM   #1
LQ Newbie
Registered: Jul 2010
Posts: 10

Rep: Reputation: 0
Startup scripts in init.d disappear after boot up


I'm running a Debian based Linux compiled for ARM9 hardware. I am trying to auto start a process on bootup but occasionally I find that my startup script becomes empty (i.e. the file still exists but has not data). The script is located in /etc/init.d/S91-sercom

Here's the script:

#!/bin/sh                                                               # /etc/init.d/S91-sercom

# Start the Serial Communication Protocol Program at boot

echo "Starting Serial Communication"
exec /usr/sbin/sercom
In the /etc/init.d directory there is a script, rcS, that appears to start all of the processes named S*. I named mine S91-sercom so it would be the last thing to start.

Here's the script that scans the directory and starts everything:

export PATH=/bin:/sbin:/usr/bin:/usr/sbin                                       
mount -t proc proc /proc                                                        
mount -t sysfs sysfs /sys                                                       
if [ -e /usr/bin/psplash ]; then                                                
        psplash 2>/dev/null &                                                   
COUNT=$(ls /etc/init.d/S* | wc -l)                                              
for s in /etc/init.d/S*; do                                                     
        if [ -x $s ]; then                                                      
                $s start                                                        
        if [ -e /tmp/psplash_fifo ]; then                                       
                PERCENT=$((100/$COUNT * $C))                                    
                psplash-write "PROGRESS $PERCENT" 2>/dev/null                   
if [ -x /etc/init.d/rc.local ]; then                                            
        /etc/init.d/rc.local start                                              
Anyone have any ideas?

Old 07-08-2010, 11:52 AM   #2
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,560

Rep: Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997
I believe the normal way to to it is to have
/etc/rc.d/init.d/scriptname with no S or K number, and then
rc.<runlever>.d/ with symlinks numbered, e.g. rc3.d for runlevel 3. Then your script can be called at different times for startup, & shutdown. If you think your script is the problem, linuxfromscratch have gpl'ed bootscripts on their site.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/init.d network dependent scripts running/failing at boot [on ubuntu server] pimanlives Linux - Newbie 5 03-15-2010 08:59 PM
[SOLVED] Optimize slack boot process / init scripts ? H_TeXMeX_H Slackware 73 10-12-2007 05:47 AM
starting named on boot without init scripts evilchild SUSE / openSUSE 1 03-05-2005 08:46 AM
X not starting on boot (init scripts) cootetom Mandriva 11 05-05-2004 09:37 AM
startup scripts for init.d/ soredz Red Hat 2 10-16-2003 04:27 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration