有时候centos需要 程序开机启动的时候  自启动

首先在 /etc/init.d/

cd /etc/init.d

文件夹下建立开机启动项

使用ln命令

使用方式 : ln [options] source dist,其中 option 的格式为 :
  
  [-bdfinsvF] [-S backup-suffix] [-V {numbered,existing,simple}]
  [--help] [--version] [--]
  说明 : Linux/Unix 档案系统中,有所谓的连结(link),我们可以将其视为档案的别名,而连结又可分为两种 : 硬连结(hard link)与软连结(symbolic link),硬连结的意思是一个档案可以有多个名称,而软连结的方式则是产生一个特殊的档案,该档案的内容是指向另一个档案的位置。硬连结是存在同一个档案系统中,而软连结却可以跨越不同的档案系统。
  ln source dist 是产生一个连结(dist)到 source,至于使用硬连结或软链结则由参数决定。
  
  不论是硬连结或软链结都不会将原本的档案复制一份,只会占用非常少量的磁碟空间。
  
  参数 :
  
  -f : 链结时先将与 dist 同档名的档案删除

-d : 允许系统管理者硬链结自己的目录

-i : 在删除与 dist 同档名的档案时先进行询问

-n : 在进行软连结时,将 dist 视为一般的档案

-s : 进行软链结(symbolic link)-v : 在连结之前显示其档名

-b : 将在链结时会被覆写或删除的档案进行备份

-S SUFFIX : 将备份的档案都加上 SUFFIX 的字尾

-V METHOD : 指定备份的方式

--help : 显示辅助说明

--version : 显示版本

软链接 (快捷方式?)

ln -s  /usr/share/denyhosts/demantion denyhosts

都放在/etc/init.d下

做自启动的时候 软连接ln -s 到/etc/init.d下  然后再chkconfig 服务 启动

[root@localhost ~]# ln --help
用法:ln [选项]... [-T] 目标 链接名     (第一种格式)或:ln [选项]... 目标         (第二种格式)或:ln [选项]... 目标... 目录 (第三种格式)或:ln [选项]... -t 目录 目标...      (第四种格式)
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, each destination (name of new link) should not already exist.
When creating hard links, each TARGET must exist.  Symbolic links
can hold arbitrary text; if later resolved, a relative link is
interpreted in relation to its parent directory.Mandatory arguments to long options are mandatory for short options too.--backup[=CONTROL]        为每个已存在的目标文件创建备份文件-b                            类似--backup,但不接受任何参数-d, -F, --directory           创建指向目录的硬链接(只适用于超级用户)-f, --force                   强行删除任何已存在的目标文件-i, --interactive           prompt whether to remove destinations-L, --logical               dereference TARGETs that are symbolic links-n, --no-dereference        treat LINK_NAME as a normal file ifit is a symbolic link to a directory-P, --physical              make hard links directly to symbolic links-r, --relative              create symbolic links relative to link location-s, --symbolic              make symbolic links instead of hard links-S, --suffix=SUFFIX         override the usual backup suffix-t, --target-directory=DIRECTORY  specify the DIRECTORY in which to createthe links-T, --no-target-directory   treat LINK_NAME as a normal file always-v, --verbose               print name of each linked file--help            显示此帮助信息并退出--version         显示版本信息并退出The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable.  Here are the values:none, off       不进行备份(即使使用了--backup 选项)numbered, t     备份文件加上数字进行排序existing, nil   若有数字的备份文件已经存在则使用数字,否则使用普通方式备份simple, never   永远使用普通方式备份Using -s ignores -L and -P.  Otherwise, the last option specified controls
behavior when a TARGET is a symbolic link, defaulting to -P.GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
请向<http://translationproject.org/team/zh_CN.html> 报告ln 的翻译错误
要获取完整文档,请运行:info coreutils 'ln invocation'
[root@localhost ~]#

使用chkconfig命令  

输出 所有服务列表

chkconfig --list

chkconfig --list denyhosts 列表中的denyhosts服务

[root@localhost ~]# chkconfig --list denyhosts注意:该输出结果只显示 SysV 服务,并不包含原生 systemd 服务。SysV 配置数据可能被原生 systemd 配置覆盖。如果您想列出 systemd 服务,请执行 'systemctl list-unit-files'。欲查看对特定 target 启用的服务请执行'systemctl list-dependencies [target]'。denyhosts       0:关    1:关    2:开    3:开    4:开    5:开    6:关

   0表示:表示关机
      1表示:单用户模式
      2表示:无网络连接的多用户命令行模式
      3表示:有网络连接的多用户命令行模式
      4表示:不可用
      5表示:带图形界面的多用户模式
      6表示:重新启动

添加服务

chkconfig --add 服务名

chkconfig --add denyhosts

删除服务

chkconfig --del denyhosts

开机启动

chkconfig 服务名 on

chkconfig denyhosts on

关闭开机启动

chkconfig denyhosts off

转载于:https://www.cnblogs.com/xxx91hx/p/4378037.html

centos 7.0 ln命令 和chkconfig 命令介绍 开机自动启 服务相关推荐

  1. php umount强制,linux中mount/umount命令的基本用法及开机自动挂载方法

    本文介绍了linux中mount/umount命令的基本用法及开机自动挂载,具体方法如下: mount命令格式如下: 格式:mount [-参数] [设备名称] [挂载点] 其中常用的参数有: -a ...

  2. linux mount 指定用户名,linux中mount/umount命令的基本用法及开机自动挂载方法

    本文介绍了linux中mount/umount命令的基本用法及开机自动挂载,具体方法如下: mount命令格式如下: 格式:mount [-参数] [设备名称] [挂载点] 其中常用的参数有: -a ...

  3. centos开机自检及开机自启服务-Dash.shell及Systemd方法

    centos开机自检及开机自启服务-Dash.shell及Systemd方法 目录 centos开机自检及开机自启服务-Dash.shell及Systemd方法 一.基本命令 二.开机登录的过程及开机 ...

  4. 远程拷贝、查看端口、vim常见快捷键、查找替换命令、grep命令、查看存储空间的命令、chkconfig命令、系统自动启动级别、主机名配置、IP地址配置、域名映射、防火墙设置

    2.1.远程拷贝 (将/export/servers/hadoop上的文件拷贝到bigdate@192.168.1.1:/export/servers/ ) scp –r /export/server ...

  5. linux开机自启服务命令,linux开机自启服务命令

    重启Linux系统或重启ECS实例后,服务未自动开启.需要在服务器中手动开启或者配置服务开启自启动.本文以Linux系统的ECS实例为例. 方法一:手动开启服务 开启Nginx.Apache.PHP. ...

  6. CentOS系统重新删除磁盘分区和挂载、开机自启(大于2T做法)

    查看磁盘挂载情况 lsblk 取消挂载 umount /data1 查看分区 parted /dev/sda 以下为进入分区模式下操作,其他均为终端 查看磁盘信息 p删除分区rm 1把sda磁盘转换为 ...

  7. 【Linux】一步一步学Linux——chkconfig命令(148)

    00. 目录 文章目录 00. 目录 01. 命令概述 02. 命令格式 03. 常用选项 04. 参考示例 05. 总结 06. 附录 01. 命令概述 chkconfig命令检查.设置系统的各种服 ...

  8. Linux 命令(106)—— chkconfig 命令

    1.命令简介 chkconfig 命令用于更新和查询系统服务的运行等级信息.它可查询操作系统在每一个运行等级中会自动执行哪些系统服务,包括各类常驻服务,比如 httpd.sshd.mysqld 等. ...

  9. linux chkconfig 目录,Linux中chkconfig命令的简介及使用方法

    Linux中chkconfig命令的简介及使用方法 发布时间:2020-08-17 16:39:04 来源:亿速云 阅读:94 作者:小新 小编给大家分享一下Linux中chkconfig命令的简介及 ...

最新文章

  1. IOS Xcode提交代码到github上
  2. scrum 11.8
  3. 机会只留给有准备的人
  4. raise errorclass(errno, errval) sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1366, u
  5. Exchange 2010发现拓扑失败
  6. vue学习中遇到的错误 Duplicate keys detected: ‘[object Object]‘. This may cause an update error.
  7. 【LeetCode笔记】128. 最长连续序列(Java、哈希表、动态规划)
  8. 传送带(洛谷-P2571)
  9. 基于环信实现在线聊天功能
  10. 数据库基础 MySQL
  11. asp.net网上零食销售商城系统
  12. 计算机实战项目、课程设计、毕业设计之[含论文+源码等]微信小程序校园论坛|商城|电商系统+后台管理系统|前后分离VUE[包运行
  13. csrss.exe病毒查杀
  14. 漫威宇宙影视作品及观看顺序
  15. 如何在Mysql中运行SQL文件
  16. win10 提升administrator权限 管理员权限
  17. thinkphp 打开速度缓慢,大多由于数据库读取问题!解决方法
  18. 饿了么“盛夏之战”,背后的底气是什么? | 一点财经
  19. 将火狐浏览器默认搜索引擎设置为“百度”
  20. Office2016激活报错:0xC004F017 | 终极解决方案

热门文章

  1. 【T_SQL】 基础 事务
  2. sed教程(七)之特殊字符
  3. VS2012 生成项目报 Lc.exe已退出,代码为-1 错误
  4. WinCE5.0如何安装.NET3.5
  5. 【十大经典数据挖掘算法】C4.5
  6. iOS:(接口适配器3)--iPhone适应不同型号 6/6plus 前
  7. std::remove
  8. 【ASP.NET】服务器控件大演练与实例分析
  9. WCF技术剖析之十一:异步操作在WCF中的应用(上篇)
  10. 【发现】iframe 放入 Updatepanel 中没有作用,整页总要闪烁一次的解决办法