How to start a script by root permission at boot time on Ubuntu server 8.10.

Today my Opmanger server is down, I start it again but my service doesn’t start by automatic at boot time. So I need to start it by root permission at startup time. And this is my solution.

1. Write your script for start a service

#!/bin/bash
echo "Start my service!!!";
cd /path/of/my/script/
./run_my_script.sh

2. Change a permission file to execute

$ cd /path/of/my/script/
$ sudo chmod +x run_my_script.sh

3. Create a symbolic link file into /etc/init.d/

$ sudo ln -s /path/of/my/script/run_my_script.sh /etc/init.d/run_my_script.sh

4. Add this script into start up time

$ sudo update-rc.d run_my_script.sh defaults
update-rc.d: warning: /etc/init.d/run_my_script.sh missing LSB style header
 Adding system startup for /etc/init.d/run_my_script.sh ...
   /etc/rc0.d/K20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc1.d/K20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc6.d/K20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc2.d/S20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc3.d/S20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc4.d/S20run_my_script.sh -> ../init.d/run_my_script.sh
   /etc/rc5.d/S20run_my_script.sh -> ../init.d/run_my_script.sh

5. Test by restart your server and check this process by ps -ef | grep run_my_script.sh

$ ps -ef | grep run_my_script.sh

Thanks for original : http://www.ubuntu-howto.info/howto/how-to-execute-a-command-program-or-script-at-startup-init-mini-howto

Tagged on: , ,

6 thoughts on “How to start a script by root permission at boot time on Ubuntu server 8.10.

  1. http://testoboostreviews.com

    Thank you, I have recently been looking for info approximately this topic for a long time
    and yours is the greatest I’ve found out till now. However, what about the bottom line? Are you positive concerning the source?

  2. Buy Xtrasize

    Good way of describing, and pleasant post to get data concerning my presentation focus,
    which i am going to present in institution of higher education.

  3. Saphire Ecigs

    I was recommended this web site through my cousin. I am not certain whether
    or not this publish is written by him as nobody else recognize such targeted about my difficulty.
    You’re amazing! Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>