How Ubuntu creates a startup script

Source: Internet
Author: User
Tags chmod

The steps for Ubuntu to create a startup script are as follows:1 Copy your startup script to the/ETC/INIT.D directoryThe following assumes that your script file name is test.sh. The steps for Ubuntu to create a startup script are as follows:
1 Copy your startup script to the/ETC/INIT.D directory
The following assumes that your script file name is test.sh.


2 Set permissions on script files
$ sudo chmod 755/etc/init.d/test.sh


3 Execute the following command to place the script in the startup script:
$ cd/etc/init.d
$ sudo update-rc.d test.sh defaults 95
Note: The number 95 is the sequence number of the script to start, according to their own needs to modify accordingly. You know how this number works when you have multiple startup scripts, and there are dependent dependencies that start between them. The output information for this command is referenced as follows:
Update-rc.d:warning:/etc/init.d/test Missing LSB information
Update-rc.d:see Adding system startup For/etc/init.d/test ...
/etc/rc0.d/k95test->. /init.d/test
/etc/rc1.d/k95test->. /init.d/test
/etc/rc6.d/k95test->. /init.d/test
/etc/rc2.d/s95test->. /init.d/test
/etc/rc3.d/s95test->. /init.d/test
/etc/rc4.d/s95test->. /init.d/test
/etc/rc5.d/s95test->. /init.d/test


To uninstall the startup script:
$ cd/etc/init.d
$ sudo update-rc.d-f test remove
The information for the output of the command is referenced as follows:
Removing any system startup links for/etc/init.d/test ...
/etc/rc0.d/k95test
/etc/rc1.d/k95test
/etc/rc2.d/s95test
/etc/rc3.d/s95test
/etc/rc4.d/s95test
/etc/rc5.d/s95test
/etc/rc6.d/k95test
2 Set permissions on script files$ sudo chmod 755/etc/init.d/test
3 Execute the following command to place the script in the startup script:$ CD/ETC/INIT.D $ sudo update-rc.d test Defaults 95 Note: Where the number 95 is the sequence number of the script to start, modify it accordingly according to your own needs. You know how this number works when you have multiple startup scripts, and there are dependent dependencies that start between them. The output information for this command is referenced as follows:

Update-rc.d:warning:/etc/init.d/test Missing LSB information
Update-rc.d:see Adding system startup For/etc/init.d/test ...
/etc/rc0.d/k95test->. /init.d/test
/etc/rc1.d/k95test->. /init.d/test
/etc/rc6.d/k95test->. /init.d/test
/etc/rc2.d/s95test->. /init.d/test
/etc/rc3.d/s95test->. /init.d/test
/etc/rc4.d/s95test->. /init.d/test
/etc/rc5.d/s95test->. /init.d/test

to uninstall the startup script:$ CD/ETC/INIT.D $ sudo update-rc.d-f Test remove command output information reference is as follows:
Removing any system startup links for/etc/init.d/test ...
/etc/rc0.d/k95test
/etc/rc1.d/k95test
/etc/rc2.d/s95test
/etc/rc3.d/s95test
/etc/rc4.d/s95test
/etc/rc5.d/s95test
/etc/rc6.d/k95test



Reference: http://rongjih.blog.163.com/blog/static/33574461201111504843245/



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.