The CentOS 7.0 ln command and the Chkconfig command introduce the power-on auto-start service

Source: Internet
Author: User
Tags directory create

Sometimes CentOS needs to start from the start of the program boot

First in/etc/init.d/

Cd/etc/init.d

Set up boot entry under folder

Using the LN command

How to use: ln [options] Source dist, where option is in the format:
  
[-BDFINSVF] [-S Backup-suffix] [-v {numbered,existing,simple}]
[--help] [--version] [--]
Note: In the Linux/unix file system, there is a so-called link, we can consider it as the alias of the file, and the link can be divided into two types: Hard link and soft link (symbolic link), hard link means that a file can have multiple names, The soft-link approach is to produce a special file with the content of the file pointing to the location of another file. Hard links exist in the same file system, while soft links can span different file systems.
LN Source Dist is the generation of a link (dist) to the source, and the use of a hard or soft link is determined by the parameter.
  
Whether a hard link or a soft link will not copy the original file, it will only occupy a very small amount of disk space.
  
Parameters:
  
-F: Delete the file with the Dist file name at the end of the link

-D: Allow system managers to hard-link their own directories

-I: Ask before deleting the file with the Dist file name

-N: When making a soft link, treat the dist as a generic file

-S: Soft link (symbolic Link)-V: Display its file name before linking

-B: Files that are overwritten or deleted at the time of the link are backed up

-S SUFFIX: Add the backed up files with SUFFIX tails

-V Method: Specify how the backup should be

--HELP: Show Auxiliary Instructions

--version: Display version

Soft links (shortcuts?) )

Ln-s/usr/share/denyhosts/demantion denyhosts

It's all under the/ETC/INIT.D.

Do self-booting when soft connect ln-s to/ETC/INIT.D and then Chkconfig service startup

[[email protected] ~]# ln--help usage: ln [options] ... [-T] Target link name (first format) or: ln [options] ... Target (second format) or: ln [options] ... Goal...      Table of contents (third format) or: ln [options] ...-t directory destination ... (fourth format) In the 1st form, create a link to TARGET with the name Link_name. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links By default, symbolic links with--symbolic. By default, the destination (name of new link) should not already exist.  When creating hard links, each TARGET must exist. Symbolic linkscan hold arbitrary text; If later resolved, a relative link isinterpreted in relation to its parent directory.      Mandatory arguments to long options is Mandatory for short options too.           --backup[=control] Creates a backup file for each existing target file-B similar to--backup, but does not accept any parameters-D,-F,--directory Create a hard link to the directory (for super users only)-F,--force forcibly delete any existing target files-I,--interactive prompt whether to rEmove destinations-l,--logical dereference TARGETs that is symbolic links-n,--no-dereference t              Reat Link_name as a normal file if it is a symbolic LINK to a directory-p,--physical Make hard links directly to symbolic links-r,--relative create symbolic Links relative to link L Ocation-s,--symbolic make symbolic links instead of hard links-s,--suffix=suffix override the U                                Sual backup suffix-t,--target-directory=directory specify the directory in which to create  The links-t,--no-target-directory treat link_name as a normal file always-v,--verbose print NAME of each linked file--help display this Help information and exit--version display version information and exit the backup suffix is ' ~ ', unless SE T with--suffix or simple_backup_suffix. The version control method may be selected via the--backup option or throughthe Version_control environmeNT variable. Here is the values:none, off is not backed up (even with the--backup option) numbered, the T backup file plus the number to sort existing, nil if a digital backup file already exists  Use a number, otherwise use the normal way to back up simple, never always use the normal way to back up Using-s ignores-l and-p. Otherwise, the last option specified Controlsbehavior if a TARGET is a symbolic link, defaulting To-p.gnu coreutils onl INE help: 

Using the Chkconfig command

Export All Services list

Chkconfig--list

Chkconfig--list denyhosts in the list of denyhosts services

[Email protected] ~]# chkconfig--list denyhosts Note: This output shows only the SysV service and does not include the native SYSTEMD service. SysV configuration data may be overwritten by native SYSTEMD configuration.      If you would like to list the SYSTEMD service, please do ' systemctl list-unit-files '.      to view services enabled for a specific target, perform      ' Systemctl list-dependencies [target] '. DenyHosts       0: Off    1: Off    2: Open    3: Open 4    : Open    5: Open    6: Off

0: Indicates shutdown
1 means: Single user mode
2: Multi-user command line mode with no network connection
3: Multi-user command-line mode with network connectivity
4 means: Not available
5: Multi-user mode with graphical interface
6 means: Reboot

Add Service

Chkconfig--add Service Name

Chkconfig--add denyhosts

Delete Service

Chkconfig--del denyhosts

Boot up

Chkconfig Service Name on

Chkconfig denyhosts on

Turn off boot

Chkconfig denyhosts off

The CentOS 7.0 ln command and the Chkconfig command introduce the power-on auto-start service

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.