LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


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

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


Hi,

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:

Code:
#!/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:

Code:
#!/bin/sh                                                                       
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 &                                                   
fi                                                                              
                                                                                
COUNT=$(ls /etc/init.d/S* | wc -l)                                              
C=1                                                                             
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                   
        fi                                                                      
        fi                                                                      
        C=$(($C+1))                                                             
done                                                                            
                                                                                
if [ -x /etc/init.d/rc.local ]; then                                            
        /etc/init.d/rc.local start                                              
fi
Anyone have any ideas?

Thanks
 
Old 07-08-2010, 10:52 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,974

Rep: Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930
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.
 
  


Reply


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 07:59 PM
[SOLVED] Optimize slack boot process / init scripts ? H_TeXMeX_H Slackware 73 10-12-2007 04:47 AM
starting named on boot without init scripts evilchild SUSE / openSUSE 1 03-05-2005 07:46 AM
X not starting on boot (init scripts) cootetom Mandriva 11 05-05-2004 08:37 AM
startup scripts for init.d/ soredz Red Hat 2 10-16-2003 03:27 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:16 AM.

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