日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2024/4/15 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos 7.0 ln命令 和chkconfig 命令介绍 开机自动启 服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

有時候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 命令介绍 开机自动启 服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。