Init Script File in Ubuntu

If we have create one execution file, for example  in /usr/local/bin/mirror . Can we put this file as init script file and always run while startup and everytime our linux system will check it ??? Off course we can use cron to make it a routine execution file, but I will use other way.

Here are my experience when I am trying to have an init script :

First chmod 755 /usr/local/bin/mirror :

jafar@dns:$ sudo chmod 755 /usr/local/bin/mirror

jafar@dns:$ sudo vi /etc/init.d/mirror


#! /bin/sh

/usr/local/bin/mirror >/dev/null 2>&1 &


jafar@dns4:~$ sudo chmod 755 /etc/init.d/mirror

jafar@dns4:~$ cd /etc/rc2.d/

jafar@dns4:/etc/rc2.d$ sudo ln -s /etc/init.d/mirror S70mirror  << made a symbolic link for startup file in rc2 directory.

And now we have an execution file that will running as an init script.






Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Use the special tag [adsense:format:group:channel] or [adsense:flexiblock:location] to display Google AdSense ads.
  • You may post PHP code. You should include <?php ?> tags.
  • Sparkline filter: [sparkline style=line|bar|winloss height=15 12,3,-2,39,23,2,......]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
5 + 5 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.