生活随笔
收集整理的這篇文章主要介紹了
crontab、chkconfig、systemd、unit、targ
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
10.23 linux任務計劃cron
# cat /etc/crontab liunx下的任務計劃配置文件crontab -u、-e、-l、-r格式:分 時 日 月 周 user command分范圍0-59,時范圍0-23,日范文:1-31,月范圍:1-12,星期分為:0-6(sunday=0 or 7)# crontab -e進入到任務計劃編輯界面0 3 * * * /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每個星期,每個月的每天的3點執行命令0 3 1-10 */2 2,5 /bin/bash /usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log //每周二周五,雙數月份的前10天的3點,執行任務# sytemctl start crond 啟動服務# systemctl stop crond //關閉服務# ps aux | grep cron 查看是否有此進程# systemctl status crond查看狀態,Actice綠色啟動該計劃在/var/spool/cron/root(最后是以用戶名命名的文件)# cront -l //列出信息# cront -e //編輯# cront -r //刪除# cront -u root -l //查看指定用戶的計劃10.24 Linux系統服務管理-chkconfig工具
# chkconfig --list //當前系統中所有服務 # ls /etc/init.d/# chkconfig network off# chkconfig --level 3 network off //指定某個級別的服務關閉# chkconfig --level 345 network off //指定多個級別的某個服務關閉# chkconfig --del network# chkconfig --add network將腳本放到/etc/init.d/下再將服務add就可以將腳本在某幾個級別運行的時候執行了10.25 systemd管理服務
# systemctl list-units --all--type=service幾個常用的服務相關的命令 #systemctl enable crond.service //讓服務開機啟動# systemctl disable crond //讓服務開機不啟動# systemctl status crod //查看狀態# systemctl stop crond //停止服務# systemctl start crond //啟動服務# systemctl restart crond //重啟服務# systemctl is-enabled crond //檢查服務是否開機啟動10.26 unit介紹
ls /usr/lib/systemd/system //系統所有unit,分為以下類型:service 系統服務target 多個unit組成的組device 硬件設備mount 文件系統掛載點automount 自動掛載點path 文件或路徑scope 不是有systemd啟動的外部進程slice進程組snapshot systemd快照socket 進程間通信套接字swap swap文件timer 定時器10.27 target介紹
系統爲了方便管理用target來管理unitsystemctl list-unit-files --type=targetsystemctl list-dependencies multi-user.target //查看指定target下面有哪些unitsystemctl get-default //查看系統默認的targetsystemctl set-default multi-user.target一個service屬于一種類型的unit多個unit組成了一個target一個target里面包含了多個servicecat /usr/lib/systemd/system/sshd/service // 看【install】部分擴展
anacron http://blog.csdn.net/strikers1982/article/details/4787226xinetd服(默認機器沒有安裝這個服務,需要yum install xinetd安裝) http://blog.sina.com.cn/s/blog_465bbe6b010000vi.htmlsystemd自定義啟動腳本http://www.jb51.net/article/100457.htm
轉載于:https://my.oschina.net/u/3803446/blog/1811690
總結
以上是生活随笔為你收集整理的crontab、chkconfig、systemd、unit、targ的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。