Linux, Unix set boot autorun command, script configuration

Source: Internet
Author: User

Turn http://blog.itpub.net/23135684/viewspace-668924/

Unix general use Method 3, for deploying OSW

Method One:
Edit/etc/rc.d/rc.local
Join the command you want to execute.
Such as:
[email protected] rc.d]# cat rc.local
#!/bin/sh
#
# this script. 'll is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style. Init stuff.

Touch/var/lock/subsys/local
Vncserver:1

Attention:
This method is only suitable for trial on Linux, and other Hp,aix are not used. The following 2 methods are relatively generic, and other UNIX systems are also available.

You need to know about the Inittab configuration file before using the second and third method.
http://space.itpub.net/370491/viewspace-216955


Method Two:
1. Create a file test under/etc/init.d/, and add the execution content.
2. Modify Execution Permissions:
Chown 777 Test
3. Create a link:
Ln-s/etc/init.d/test/etc/rc.d/rc3.d/s900test

Attention:
1. Note that the Execute permission is added to the test file.
2. Always use absolute paths when creating links.
3. The focus of this approach is not that test is stored in the/ETC/INIT.D directory (typically we will have the script automatically started with the system in this directory), but instead the link file created S900test placed in the/ETC/RC.D/RC3.D directory.
Reason:
1. Operating level:
[Email protected] rc.d]# RunLevel
N 3

2.inittab Default configuration:
L0:0:WAIT:/ETC/RC.D/RC 0
L1:1:WAIT:/ETC/RC.D/RC 1
L2:2:WAIT:/ETC/RC.D/RC 2
L3:3:WAIT:/ETC/RC.D/RC 3 (startup will wait for all commands under the/ETC/RC.D/RC3.D directory to complete.) )
L4:4:WAIT:/ETC/RC.D/RC 4
L5:5:WAIT:/ETC/RC.D/RC 5
L6:6:WAIT:/ETC/RC.D/RC 6

Method Three:
This approach is essentially the same as the previous one, both from the Inittab configuration file.
/etc/inittab can be modified directly
Join:
Test:35:wait:/bin/echo "123456" >/aaa 2>&1

The system will also wait for the/bin/echo "123456" command to finish at startup.

Attention:
1.:wait: As the keyword, meaning to wait for the command to finish. Don't write anything else or make a mistake.
2. The absolute path is executed at the end of the command or write execution script. Like/bin/echo instead of writing an echo.

If we are HP-UX or IBM AIX, we can use the second or third approach.

Linux, Unix set boot autorun command, script configuration

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.