Init.d and Scripts : Starting a Script before of others

Dear Experts,

I have a Script in order to run  2 applications, one is in order to   have communication with a gsm modem, the other  is to have control for an equipment.  
 I want to start my script before the all other programs or  in the end of all programs,  because I need have a serial communication and have an information obtained by the equipment but is necessary start (or in the end) more slowly to have the correct answer  

what can I do?


my script is:

start() {
stop() {
      echo -n "stoping services..."
      /sbin/ifdown -a
restart() {

case "$1" in
      echo $"Usage: $0 {start|stop|restart}"
      exit 1

exit $?

Who is Participating?
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Init will start the scripts in order, and doesn't itself have a facility to delay by an amount of time. But you can put a sleep command in the final script so it waits 3 minutes before doing anything, if you think that's really necessary.
You might want to arrange that a console is enabled for login before this sleep.
You could be better off having the early script (that does the setting up) create a file when setup is complete and the final script wait for that file to appear (in a small sleep loop say). Guessing some amount of time to wait is always a bit hit and miss.
joolsConnect With a Mentor Commented:
What distro are you using?

Redhat can be configured by adding it so chkconfig controls it; you can put the following like in your script;

   # chkconfig: 2345 10 90
This tells it to be run in levels 2,3,4&5, start is 10, end is 90.

Or you can do it manually by copying it to the run level you want it to start at and naming it something like;

More detail can be given if you let us know your distro.

hernan007Author Commented:
iools,  thanks

Im using  debian lenny  with an AMD Geode lx800 processor ,

is possible run my script after 3 minutes  that  the complete system is loaded??

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

hernan007Author Commented:
the name of my Script is   S50mareografod  
you mean after all the run scripts have started?

Just add it to the rc.local script on your system then.
hernan007Author Commented:

Now  I have my  lines


in the start section in rc.local script   but it not work lines not are loaded

I think that is necessary have the script in the end when the system is loaded in other case the communication with my data logger is incomplete (I have files with not completed information).

in the sleep command my serial ports works?  or all the system is affected ?

thanks ..

What happens when you run rc.local.

Can you check the startup logs for errors.
Is the missing "/" for `home/ipn/datalogger/extraccion/mareografod&`
a typo???

Ricardo ElenaManager, US OperationsCommented:
an easy way is to put your script location in the file /etc/rc.local or /etc/boot.local if your linux is Suse
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.