Ubuntu 14.04 Set up the boot script method _linux

Source: Internet
Author: User

Rc.local Script

The rc.local script is a script that will be executed automatically after Ubuntu is powered on, and we can add command-line directives to the script. The script is located under the/etc/path and requires root permission to be modified.

The script is specific in the following format:

#!/bin/sh-e # # rc.local # # This script is executed in the end of each
multiuser runlevel.
# Make sure that script would ' exit 0 ' on success or any other
# value On error.
# in order to
-enable or disable this script just change the execution
# bits.
# by
Default this script does nothing.
 
Exit 0

Note: Be sure to add the command before exit 0

How to add a boot up script to Ubuntu

1, create a new script file new_service.sh

#!/bin/bash
# command content
 
exit 0

2, set permissions

sudo chmod 755 new_service.sh

3, put the script in the boot directory

sudo mv new_service.sh/etc/init.d/

4, add the script to the startup script

Execute the following instruction, where 90 indicates a priority, the higher the later the execution

cd/etc/init.d/
sudo update-rc.d new_service.sh defaults 90

Remove Ubuntu Boot script

sudo update-rc.d-f new_service.sh Remove

Summarize

The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.

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.