Lenny automatic startup: Difference between revisions

From embeddedTS Manuals
(Created page with "From Debian the most straightforward way to add your application to startup is to create a startup script. This is an example simple startup script that will toggle the red l...")
 
No edit summary
Line 34: Line 34:
</source>
</source>


To make your application startup from the initrd you only need to add this from the linuxrc script.  Usually the best place to add in your application is right after /mnt/root/ is mounted so the Debian libraries and applications are available.
To make your application startup from the initrd you only need to add the required lines (no need for the Debian init syntax) to the linuxrc script.  Usually the best place to add in your application is right after /mnt/root/ is mounted so the Debian libraries and applications are available.

Revision as of 10:57, 30 August 2012

From Debian the most straightforward way to add your application to startup is to create a startup script. This is an example simple startup script that will toggle the red led on during startup, and off during shutdown. In this case I'll name the file customstartup, but you can replace this with your application name as well.

Edit the file /etc/init.d/customstartup to contain this:

 #! /bin/sh
 # /etc/init.d/customstartup
 
 case "$1" in
   start)
     /usr/local/bin/ts7500ctl --redledon
     ;;
   stop)
     /usr/local/bin/ts7500ctl --redledoff
     ;;
   *)
     echo "Usage: customstartup start|stop" >&2
     exit 3
     ;;
 esac
 
 exit 0
Note: The $PATH variable is not set up by default in init scripts so this will either need to be done manually or the full path to your application must be included.

To make this run during startup and shutdown:

update-rc.d customstartup defaults

To manually start and stop the script:

/etc/init.d/customstartup start
/etc/init.d/customstartup stop

To make your application startup from the initrd you only need to add the required lines (no need for the Debian init syntax) to the linuxrc script. Usually the best place to add in your application is right after /mnt/root/ is mounted so the Debian libraries and applications are available.