Linux system Boot Execution Script __linux

Source: Internet
Author: User

There are two ways of doing this:

One way is to configure the service based on the run level

One way is to perform a local special configuration


For example, the task is to run the command at startup Hacker


Mode one:

1, set up the/etc/rc.d/init.d/hacker of the start script

Content is:

#!/bin/bash

/usr/local/bin/hacker


Set the properties of the file to executable: #chmod +x/etc/rc.d/init.d/hacker

  

2. View computer Run level

See Id:5:initdefault in file/etc/inittab:, then this system runs at level 5

 

3. To the/ETC/RC5.D directory, make a soft connection to the executable file you want to execute, and at the beginning of the name with a capital S letter, the number size after s represents the order of execution, the larger the number, the higher the execution.

#ln-S/ETC/RC.D/INIT.D/HACKER/ETC/RC5.D/S100CVSLOCKD

#ln-S/ETC/RC.D/INIT.D/HACKER/ETC/RC0.D/K20CVSLOCKD

  

Mode two: Add Exec/usr/local/bin/hacker in/etc/rc.d/rc.local

The way is to start the hacker at the end


There is another way:

Configure. bashrc files

VI ~/.BASHRC

You just need to join/home/xxx/xxx/bin/hacker.sh start to create a program that starts automatically when a user logs on.

Related Article

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.